标签:present include ase rip mit chm case shanghai tmp
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1243 Accepted Submission(s): 546
1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 using namespace std; 6 7 #define LL long long 8 9 long long C(LL a,LL b) 10 { 11 return a * b * a * b; 12 } 13 int main() 14 { 15 long long T,m,n,k; 16 int cas = 0; 17 scanf("%lld",&T); 18 while(T--) 19 { 20 LL sum; 21 double ans=0, p; 22 scanf("%lld%lld%lld",&m,&n,&k); 23 for(LL i=0; i<m; i++) 24 { 25 for(LL j=0; j<n; j++) 26 { 27 sum = C(i,n)+C((m-i-1),n)+C(j,m)+C((n-j-1),m); 28 sum = sum - C(i,j) - C(i,(n-j-1)) - C((m-i-1),j ) - C((m-i-1),(n-j-1)) ; 29 p = sum * 1.0 / C(m,n); 30 31 double tmp=1; 32 for (LL jj = 1; jj <= k; ++jj) 33 tmp *= p; 34 ans=ans+1-tmp; 35 } 36 } 37 printf("Case #%d: %.0f\n",++cas,ans); 38 } 39 return 0; 40 }
标签:present include ase rip mit chm case shanghai tmp
原文地址:http://www.cnblogs.com/bofengyu/p/6786310.html