HDU2201
水~
分析:n,m。對于第一個人不抽到m號座位概率為(n-1)/n,第二個人為(n-2)/(n-1).。。。第m個人為1/(n-m+1).。。。
相乘之后則為 1/n
View Code 1 /* 2 水~ 3 */ 4 #include<stdio.h> 5 #include<string.h> 6 #include<stdlib.h> 7 #include<algorithm> 8 #include<iostream> 9 #include<queue> 10 #include<stack> 11 #include<math.h> 12 #include<map> 13 using namespace std; 14 const int maxn = 1005; 15 int main(){ 16 int n,m; 17 while( scanf("%d%d",&n,&m)==2 ){ 18 printf("%.2lf\n",1.0/(1.0*n)); 19 } 20 return 0; 21 }?
轉載于:https://www.cnblogs.com/xxx0624/archive/2013/03/10/2952588.html
總結
- 上一篇: 用数据辅助设计-搜索中的实践
- 下一篇: mac安装brew简单方法