The 2018 ACM-ICPC Chinese Collegiate Programming Contest Take Your Seat
Posted tingtin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The 2018 ACM-ICPC Chinese Collegiate Programming Contest Take Your Seat相关的知识,希望对你有一定的参考价值。
/*
证明过程如下 :
第一种情况:
按1到n的顺序上飞机,1会随意选一个,剩下的上去时若与自己序号相同的
座位空就坐下去,若被占了就也会随意选一个。
求最后一个人坐在应坐位置的概率
*/
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <string> 5 #include <algorithm> 6 #include <utility> 7 #include <vector> 8 #include <map> 9 #include <queue> 10 #include <stack> 11 #include <cstdlib> 12 typedef long long ll; 13 #define lowbit(x) (x&(-x)) 14 #define ls l,m,rt<<1 15 #define rs m+1,r,rt<<1|1 16 using namespace std; 17 double x=0.5; 18 double y=1.0; 19 int main() 20 { 21 int t,n,m; 22 scanf("%d",&t); 23 for(int i=1;i<=t;i++) 24 { 25 scanf("%d%d",&n,&m); 26 if(n==1){//特判 27 printf("Case #%d: %.6f %.6f ",i,y,1.0*(m+1)/(2*m)); 28 } 29 else{ 30 printf("Case #%d: %.6f %.6f ",i,x,1.0*(m+1)/(2*m)); 31 } 32 } 33 return 0; 34 }
以上是关于The 2018 ACM-ICPC Chinese Collegiate Programming Contest Take Your Seat的主要内容,如果未能解决你的问题,请参考以下文章
The 2018 ACM-ICPC Asia Qingdao Regional Contest
The 2018 ACM-ICPC Asia Beijing Regional Contest
The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online J Press the Button
The 2018 ACM-ICPC China JiangSu Provincial Programming Contest(第六场)
Rolling The Polygon (2018-2019 ACM-ICPC, China Multi-Provincial Collegiate Programming Contest)(The
The 2018 ACM-ICPC China JiangSu Provincial Programming Contest快速幂取模及求逆元