标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 26867 Accepted Submission(s):
11176
1 2
50.00%
1 #include<stdio.h> 2 int biao[11],sieve[11]; 3 int main() 4 { 5 int i,n,total=1; sieve[1]=0; sieve[2]=1; 6 for(i=1;i<11;i++) 7 { 8 total*=i; biao[i]=total; 9 if(i>=3) 10 sieve[i]=(i-1)*(sieve[i-1]+sieve[i-2]); 11 } 12 scanf("%d",&i); 13 while(i--) 14 { 15 scanf("%d",&n); 16 if(n==0) 17 printf("0.00%c\n",‘%‘); 18 else if(n>=1&&n<=6) 19 printf("%.2lf%c\n",sieve[n]*100.0/biao[n],‘%‘); 20 else 21 printf("%.2lf%c\n",sieve[7]*100.0/biao[7],‘%‘); 22 } 23 return 0; 24 }
//__int64! (但此题有规律,用不到);
标签:
原文地址:http://www.cnblogs.com/fengshun/p/4598977.html