洛谷 P2719 搞笑世界杯
作者:互联网
题目传送门
解题思路:
f[i][j]表示买i张A票,j张B票的概率。
AC代码:
1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 double f[2501][2501]; 7 int n; 8 9 int main() { 10 scanf("%d",&n); 11 n /= 2; 12 for(int i = 2;i <= n; i++) 13 f[i][0] = f[0][i] = 1; 14 for(int i = 1;i <= n; i++) 15 for(int j = 1;j <= n; j++) 16 f[i][j] = (f[i-1][j] + f[i][j-1]) * 0.5; 17 printf("%.4lf",f[n][n]); 18 return 0; 19 }
标签:洛谷,int,搞笑,scanf,传送门,P2719,include,2501 来源: https://www.cnblogs.com/lipeiyi520/p/12037445.html