标签:.com font main 组合 can block pre logs one
1 #include<stdio.h>
2 long long arr[21];
3 long long c(int a,int b)
4 {
5 long long i,sum=1,j;
6 for (i=a,j=1;i>=a-b+1,j<=b;i--,j++) sum=sum*i/j;
7 return sum;
8 }
9 void func()
10 {
11 int i;
12 arr[1]=0;arr[2]=1;
13 for(i=3;i<=26;i++)
14 arr[i]=(i-1)*(arr[i-1]+arr[i-2]);
15 }
16 int main(){
17 int n;
18 while(scanf("%d",&n)!=EOF&&n!=0){
19 int h=n/2,i;
20 long long ans=0;
21 func();
22 for(i=2;i<=h;i++){
23 ans+=c(n,i)*arr[i];
24 //printf("%I64d %I64d\n",c(n,i),arr[i]);
25 }
26
27 ans++;
28 printf("%I64d\n",ans);
29 }
30 return 0;
31 }
标签:.com font main 组合 can block pre logs one
原文地址:http://www.cnblogs.com/cenariusxz/p/6578010.html