标签:turn 感慨 include code inpu logs namespace 身边 closed
Input输入数据包含多个多个测试实例,每个测试实例占用一行,每行包含一个正整数n(1<n<=20),n表示8006的网友的人数。Output对于每行输入请输出可能的错误方式的数量,每个实例的输出占用一行。Sample Input
2 3
Sample Output
1 2
数学题
1 #include <iostream> 2 3 using namespace std; 4 5 int main() 6 { 7 long long a[20]; 8 a[0]=1; 9 a[1]=2; 10 int t; 11 while(cin>>t) 12 { 13 for(int i=2;i<t-1;i++) 14 a[i]=(i+1)*(a[i-1]+a[i-2]); 15 cout<<a[t-2]<<endl; 16 } 17 return 0; 18 }
打表大法好
1 #include <iostream> 2 using namespace std; 3 #include<string.h> 4 #include<set> 5 #include<stdio.h> 6 #include<math.h> 7 #include<queue> 8 #include<map> 9 #include<algorithm> 10 #include<cstdio> 11 #include<cmath> 12 #include<cstring> 13 #include <cstdio> 14 #include <cstdlib> 15 #include<stdio.h> 16 int main() 17 { 18 unsigned long long a[20]; 19 int n,i; 20 a[1]=1; 21 a[2]=2; 22 a[3]=9; 23 a[4]=44; 24 a[5]=265; 25 a[6]=1854; 26 a[7]=14833; 27 a[8]=133496; 28 a[9]=1334961; 29 a[10]=14684570; 30 a[11]=176214841; 31 a[12]=2290792932; 32 a[13]=32071101049; 33 a[14]=481066515734; 34 a[15]=7697064251745; 35 a[16]=130850092279664; 36 a[17]=2355301661033953; 37 a[18]=44750731559645106; 38 a[19]=895014631192902121; 39 int t; 40 while(cin>>t) 41 cout<<a[t-1]<<endl; 42 return 0; 43 }
标签:turn 感慨 include code inpu logs namespace 身边 closed
原文地址:http://www.cnblogs.com/dulute/p/7273001.html