1231
来源:互联网 发布:c程序设计经典编程题 编辑:程序博客网 时间:2024/06/13 07:06
题目描述
There are n ants on a polygon. The polygon has n edges and every ant is on a corner at first. Than the ants start to move on edges. A corner connects two edges, so the ants choose to move on one edge of the two randomly. If two ants move on a same edge , they will be angry. Give you the number n. Calculate the probability that there exists some ants angry, after their first choice.
输入
Multiple cases. Every case takes a line with the number n. (3 <= n <= 15)
输出
A case a line.Print the probability, with exactly 6 digits after the decimal point.
样例输入
4
样例输出
0.875000
提示
#include<stdio.h>#include<math.h>int main(){ int n,i; while(scanf("%d",&n)!=EOF) printf("%.6f\n",1-pow(0.5,n-1)); return 0;}
0 0
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- 1231
- hdu 1231 hdoj 1231
- hdu 1231
- hdu 1231
- hdu 1231
- hdu 1231
- hdu 1231
- HDOJ 1231
- 51node 1001 数组中和等于K的数对
- Android Animation的实现原理
- 你是怎么思考的?
- OpenTSDB安装极简备忘
- 模式识别第5次作业
- 1231
- 细节决定未来(输出链表)
- python中的os模块使用方法
- 罚函数法求解约束问题最优解
- Java语言基础(六)之 —— 循环嵌套
- 1255
- JS实现页面返回顶部的匀加速运动
- 十六周—职工信息表
- 随笔2016年最后的状态.