c语言sscanf函数的用法是什么
219
2022-08-29
SDUT 2623:The number of steps
The number of steps
Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms …). Now she stands at the top point(the first layer), and the KEY of this maze is in the lowest layer’s leftmost room. Known that each room can only access to its left room and lower left and lower right rooms .If a room doesn’t have its left room, the probability of going to the lower left room and lower right room are a and b (a + b = 1 ). If a room only has it’s left room, the probability of going to the room is 1. If a room has its lower left, lower right rooms and its left room, the probability of going to each room are c, d, e (c + d + e = 1). Now , Mary wants to know how many steps she needs to reach the KEY. Dear friend, can you tell Mary the expected number of steps required to reach the KEY?
输入
There are no more than 70 test cases.
In each case , first Input a positive integer n(0
The input is terminated with 0. This test case is not to be processed.
输出
Please calculate the expected number of steps required to reach the KEY room, there are 2 digits after the decimal point.
示例输入
30.3 0.70.1 0.3 0.60
示例输出
3.41
迷失在幽谷中的鸟儿,独自飞翔在这偌大的天地间,却不知自己该飞往何方…
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~