http://acm.hdu.edu.cn/showproblem.php?pid=1570
数字较小,打表,然后,过
View Code
1 #include<stdio.h> 2 int main() 3 { 4 int i,a[20],n,m,t,ans; 5 char s[3]; 6 a[1]=a[0]=1; 7 for(i=2;i<=10;i++) 8 a[i]=a[i-1]*i; 9 scanf("%d",&t); 10 gets(s); 11 while(t--) 12 { 13 scanf("%s%d%d",&s,&n,&m); 14 if(s[0]=='A') 15 ans=a[n]/a[n-m]; 16 else ans=a[n]/(a[m]*a[n-m]); 17 printf("%d\n",ans); 18 } 19 return 0; 20 }