【CSDN编程竞赛第八期】赛后感

CSDN编程竞赛第八期地址:https://edu.csdn.net/contest/detail/20

赛后感

这次比赛第一题很简单,只要暴力匹配每一个字符,msg中的每一个字符都在words中即可。
但后面的题目却都是动态规划题,题目类型分配极度不均。
最后一题题目自带的Python框架居然没有b参数。

建议

1.将题目类型分配均匀,尽量包含更多的知识点,才可以全面学习,充分发挥编程能力。
2.对题目检查要更加细致。

题目

1、代写匿名信

【CSDN编程竞赛第八期】赛后感_第1张图片
小Q想要匿名举报XX领导不务正业! 小Q害怕别人认出他的字迹。
他选择从报纸上剪裁下来英文字母组成自己的举报信。
现在小Q找来了报纸,和自己的举报信的Txt,
你能帮他确定一下是否能够完成匿名信吗?

输入描述:

第一行输入报纸上的英文。
第二行输入小Q匿名信的内容。
(1<=len(str)<=10000)

输出描述:

如果能完成输出”Yes”,否则输出”No”。

输入样例:

Asdadsadas dsadas
das

输出样例:

Yes

2、小艺改编字符串

【CSDN编程竞赛第八期】赛后感_第2张图片
已知字符串str.
添加至少多少字符可以使得str变成回文串。

输入描述:

输入字符串s.(1<=len(str)<=1000)

输出描述:

输出最小需要添加字符的数量。

示例:

示例1
输入

abab

输出

1

示例2
输入

rnieaovquiwvsrocd

输出

12

提示
样例一:增加字符a或b,可形成回文串
样例二:至少增加12个字符可形成回文串dcrswuqaeinr:dcrnieaorsvquwiwuqvsroaeinrcd

3、开学趣闻之美食诱惑

【CSDN编程竞赛第八期】赛后感_第3张图片
小艺酱又开学了,可是在上学的路上总会又各种意想不到的美食诱惑让小艺酱迟到。
假设小艺酱家到学校是一个n*n的矩阵。
每个格子包含一个诱惑值p,诱惑着小艺,让她迟到。
小艺位于矩阵的左上角,学校在矩阵的右下角落。
小艺想知道自己到达学校所要经历的最小诱惑值是?

输入描述:

第一行输入整数n。(1<=n<=100)
以下n行每行有n个整数表示诱惑值。(1<=p<=100)

输出描述:

输出到达学校需要经历的最小诱惑值。

输入样例:

3
1 3 7
6 2 1
9 8 0

输出样例:

7

4、争抢糖豆

【CSDN编程竞赛第八期】赛后感_第4张图片
抓糖豆,小Q与小K都喜欢吃糖豆。
但是糖豆分两种,超甜糖豆和普通糖豆。
现在有w个超甜糖豆和b个普通糖豆。
小Q和小K开始吃糖豆,他们决定谁先吃到超甜糖豆谁就获胜。
小K每次吃的时候会捏碎一颗糖豆。
小Q先吃,小Q想知道自己获胜的概率。
如果两个人都吃不到超甜糖豆小K获胜。

输入描述:

输入两个整数w,b。(0<=w,b<=1000)

输出描述:

答案保留9位小数。

输入样例:

1 3

输出样例:

0.500000000

Bag of mice
time limit per test: 2 seconds
memory limit per test: 256 megabytes
inputstandard input
outputstandard output

The dragon and the princess are arguing about what to do on the New Year’s Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to come to an amicable agreement, so they decide to leave this up to chance.
They take turns drawing a mouse from a bag which initially contains w w w white and b b b black mice. The person who is the first to draw a white mouse wins. After each mouse drawn by the dragon the rest of mice in the bag panic, and one of them jumps out of the bag itself (the princess draws her mice carefully and doesn’t scare other mice). Princess draws first. What is the probability of the princess winning?
If there are no more mice in the bag and nobody has drawn a white mouse, the dragon wins. Mice which jump out of the bag themselves are not considered to be drawn (do not define the winner). Once a mouse has left the bag, it never returns to it. Every mouse is drawn from the bag with the same probability as every other one, and every mouse jumps out of the bag with the same probability as every other one.

Input
The only line of input data contains two integers w w w and b ( 0   ≤   w ,   b   ≤   1000 ) b (0 ≤ w, b ≤ 1000) b(0w,b1000).
Output
Output the probability of the princess winning. The answer is considered to be correct if its absolute or relative error does not exceed 1 0 − 9 10^{-9} 109.

Examples
input
1 3

output
0.500000000

input
5 5

output
0.658730159

Note
Let’s go through the first sample. The probability of the princess drawing a white mouse on her first turn and winning right away is 1/4. The probability of the dragon drawing a black mouse and not winning on his first turn is 3/4 * 2/3 = 1/2. After this there are two mice left in the bag — one black and one white; one of them jumps out, and the other is drawn by the princess on her second turn. If the princess’ mouse is white, she wins (probability is 1/2 * 1/2 = 1/4), otherwise nobody gets the white mouse, so according to the rule the dragon wins.

你可能感兴趣的:(python,开发语言,c语言)