#include<iostream>usingnamespace std;intcheck(int m){int a[40]={1,1,2};for(int i =3; i < m; i++){
a[i]= a[i -2]+ a[i -1];}return a[m -1];}intmain(){int n;while(cin >> n){int m =0;for(int i =0; i < n; i++){
cin >> m;if(m <1&& m >40){return0;}
cout <<check(m)<< endl;}}}
42、2042
#include<iostream>usingnamespace std;intcheck(int m){int n =3;for(int i =0; i < m; i++){
n =(n -1)*2;}return n;}intmain(){int n;while(cin >> n){int m =0;for(int i =0; i < n; i++){
cin >> m;if(m <0&& m >30){return0;}
cout <<check(m)<< endl;}}}
43、2043
#include<iostream>#include<string>usingnamespace std;boolcheck(string m){if(m.length()<8||m.length()>16){returnfalse;}int a[4]={0}, n =0;for(int i =0; i < m.length(); i++){if(m[i]>='A'&& m[i]<='Z'){
a[0]=1;}elseif(m[i]>='a'&& m[i]<='z'){
a[1]=1;}elseif(m[i]>='0'&& m[i]<='9'){
a[2]=1;}elseif(m[i]=='~'|| m[i]=='!'|| m[i]=='@'|| m[i]=='#'|| m[i]=='$'|| m[i]=='%'|| m[i]=='^'){
a[3]=1;}}for(int i =0; i <4; i++){if(a[i]==1){
n++;}}if(n >2){returntrue;}else{returnfalse;}}intmain(){int n;while(cin >> n){
string m ;
cin.ignore();for(int i =0; i < n; i++){getline(cin, m);if( m.length()>50){return0;}if(check(m)){ cout <<"YES"<< endl;}else{
cout <<"NO"<< endl;}}}}
44、2044
#include<iostream>#include<string>usingnamespace std;longlongcheck(int m,int n){longlong a[54]={0,1,2};for(int i=3;i<n;i++){
a[i]= a[i -1]+ a[i -2];}return(a[n-m]);}intmain(){int n;while(cin >> n){int m;int k;
cin.ignore();for(int i =0; i < n; i++){
cin >> m;
cin >> k;if(m >0&& m <k && k <50){
cout <<check(m, k)<< endl;}}}}
#include<iostream>#include<iomanip>usingnamespace std;doublecheck(int m){double a =1;double b[21]={0,0,1};for(int i =0; i < m; i++){
a = a *(m - i);}for(int i =3; i < m +1; i++){
b[i]=(b[i -1]+ b[i -2])*(i -1);}return b[m]/ a;}intmain(){int m;while(cin >> m){int n =0;
cin.ignore();for(int i =0; i < m; i++){
cin >> n;if(n >1&& n <=20){
cout << fixed <<setprecision(2)<<check(n)*100<<"%"<< endl;}}}}
49、2049
#include<iostream>#include<iomanip>usingnamespace std;longlongcheck(int m,int k){longlong b[21]={0,0,1};longlong c =1;for(int i =3; i < k +1; i++){
b[i]=(b[i -1]+ b[i -2])*(i -1);}for(int i =0; i < m-k; i++){
c = c *(m-i);
c = c /(i+1);}return b[k]*c;}intmain(){int m;while(cin >> m){int n =0,k=0;
cin.ignore();for(int i =0; i < m; i++){
cin >> n;
cin >> k;if(k >1&& n <=20&&n>=k){
cout <<check(n,k)<< endl;}}}}
50、2050
#include<iostream>#include<iomanip>usingnamespace std;longlongcheck(int m){longlong a[10001]={0};for(int i =1; i < m+1; i++){
a[i]=2* i * i -i +1;}return a[m];}intmain(){int m;while(cin >> m){int n =0;
cin.ignore();for(int i =0; i < m; i++){
cin >> n;if(n >0&&n <=10000){
cout <<check(n)<< endl;}}}}