当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3558:Map Generator returns (MG-II)

Special Judge 特殊评判
题目描述

You have just finished your research of FAMI algorithm (see task “Map Generator”). You are very proud of yourself and even expect being paid bonus this month. Your boss, whose nickname is Dean, asks you to come over to his office for a moment. You expect thanks and even promotion. But …

‘What is this?’ asks Dean and shows you your latest report.

‘Well, h-m-m, these are results of my FAMI algorithm research, a-a-a,’ you answer. It seems that your dreams about soon promotion are … just dreams. But you still do not understand what is wrong about your report.

‘I can read, by the way,’ continues Dean. ‘I am talking about the absolute error. Why it is so big? I require better results!’

When you argue with your boss, the best argument is silence. So, now instead of bonuses and promotions you need to rewrite your program.

Developers wish the map generator produced connected maps. A map is said to be connected when between any pair of planets there is a path, consisting of one or more hyperspace tunnels. Unfortunately, it appears that maps generated by FAMI algorithm sometimes are not connected. You are assigned to research this phenomenon.

You need to write a program which being given numbers N and P calculates probability of generating connected map by FAMI algorithm.

输入解释

The input, as in the previous task, consists of two lines. The first line contains an integer number N (1 ≤ N ≤ 20), while the second line contains a real number P (0 ≤ P ≤ 1).

输出解释

The output needs to contain an answer - the single real number which is the probability of generating connected map by FAMI algorithm. Absolute error of the answer must not exceed 10−8.

输入样例
3
0.5
输出样例
0.5
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3558

最后修改于 2020-10-29T07:04:31+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 65536