标签:
题目链接:http://acm.swust.edu.cn/problem/649/
1
2
|
7
0.4
|
1
|
0.289792
|
1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 int main() 5 { 6 double dp[201][201], p; 7 int i, j, n; 8 while (cin >> n >> p) 9 { 10 for (i = 1; i <= n; i++){ 11 dp[i][0] = 0; 12 dp[0][i] = 1; 13 } 14 for (i = 1; i <= n; i++){ 15 for (j = 1; j <= n; j++){ 16 dp[i][j] = dp[i - 1][j] * p + dp[i][j - 1] * (1 - p); 17 } 18 } 19 cout << dp[n][n] << endl; 20 } 21 return 0; 22 }
swust oj 649--NBA Finals(dp,后台略(hen)坑)
标签:
原文地址:http://www.cnblogs.com/zYx-ac/p/4574708.html