id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
12,000
int calculate(int); int main() { int n, i, j = 0; int flag = 0, a; int str1[100000]; int str2[100000]; cin >> n; if(n == 0) { cout << "1" << endl; return 0; } else { if(n == 1) { cout << "2" << endl; return 0; } memset(str1, -1, sizeof(str1)); memset(str2, 0, sizeof(str2)); str1[0] = 2; for(i = 1; i < n; i++) { while(str1[j] != -1) { str2[j] = str1[j] * 2 + str2[j]; if(str2[j] >= 10) { str2[j] = str2[j] - 10; str2[j + 1]++; } j++; } if(i == n - 1) break; for(j = 0; j < 1000; j++) { str1[j] = str2[j]; str2[j] = 0; } j = 0; } j = 100000 - 1; while(str2[j] == 0) j--; for(i = j; i >= 0; i--) { cout << str2[i]; } } return 0; }
25
12,001
int main() { int ans[1000] = {0}, l = 0, i, n; cin >> n; ans[0] = 1; l = 1; while (n--) { for (i = 0; i < l; i++) ans[i] = ans[i] << 1; for (i = 0; i < l; i++) { if (i == l - 1 && ans[i] > 9) { l++; } ans[i + 1] += ans[i] / 10; ans[i] %= 10; } } for (i = l - 1; i >= 0; i--) { cout << ans[i]; } cout << endl; return 0; }
25
12,002
int main() { int N; //N???? cin >> N; int num[32] = {0}; num[1] = 1; int cntbyte = 1; for(int i = 1 ; i <= N ; i++) { for(int j = 1 ; j <= cntbyte ; j++) num[j] *= 2; for(int j = 1 ; j <= cntbyte ; j++) { if (num[j] >= 10) { num[j] -= 10; num[j+1] ++; } } if (num[cntbyte + 1] != 0) cntbyte ++; } for (int k = cntbyte; k >= 1; k--) cout << num[k]; cin.get(); cin.get(); return 0; }
25
12,003
int ans[1000]; int main() { memset(ans,0,sizeof(ans)); int n,i; cin>>n; ans[1]=1; ans[0]=0; for(;n>0;n--) { for(i=1;i<1000;i++) { ans[i]=ans[i]*2+ans[i-1]/10; ans[i-1]=ans[i-1]%10; } } for(i=999;ans[i]==0;i--); for(;i>0;i--) cout<<ans[i]; }
25
12,004
/* * 3.cpp * * Created on: 2011-12-31 * Author: 2011 */ int main() { int n; cin >> n; int i, j, k; char ans[1000]; int tans[1000]; ans[0] = 1 + '0'; ans[1] = '\0'; for (i = 0; i < n; i++) { int len = strlen(ans); for (j = 0; j < len; j++) { tans[j] = (ans[j] - '0') * 2; } int carry = 0; for (j = 0; j < len; j++) { int carrytem = tans[j] / 10; tans[j] = (tans[j] + carry) % 10; carry = carrytem; } if (carry == 1) { tans[j] = 1; j++; } for (k = 0; k < j; k++) { ans[k] = tans[k] + '0'; } ans[j] = '\0'; } int lentem = strlen(ans); for (i = lentem - 1; i >= 0; i--) cout << ans[i]; return 0; }
25
12,005
int a[1000]; void jisuan(int a[]) { int l,i,flag; for(i=999;i>=0;i--) { if(a[i]!=0) { l=i; break; } } a[0]=a[0]*2; flag=a[0]/10; a[0]=a[0]%10; for(i=1;i<=l+1;i++) { a[i]=2*a[i]+flag; flag=a[i]/10; a[i]=a[i]%10; } } int main() { int N,i,l; cin>>N; for(i=0;i<1000;i++) a[i]=0; a[0]=1; for(i=0;i<N;i++) jisuan(a); for(i=999;i>=0;i--) { if(a[i]!=0) { l=i; break; } } for(i=l;i>=0;i--) cout<<a[i]; return 0; }
25
12,006
/* * a3.cpp * * Created on: 2011-12-31 * Author: 2011 */ /* * 3.cpp * * Created on: 2011-12-31 * Author: 2011 */ int main() { int a[100]={0},i=0,n,b=1; cin>>n; if(n<32){ for(i=0;i<n;i++){ b*=2; } cout<<b<<endl; } else{ a[0]=2; int len=1,j=0; for(i=1;i<n;i++) { for(j=0;j<len;j++) a[j]=a[j]*2; for(j=0;j<len;j++) if(a[j]>=10){ a[j+1]++; a[j]=a[j]-10; } if(a[len]!=0)len++; } for(i=len-1;i>=0;i--)cout<<a[i]; //} cout<<endl;} return 0; }
25
12,007
/** *@ file 1000012834_002homework.cpp *@ author ??? *@ date 2010-12-15 *@ description * ?????????2?N?? */ int main() { int j, i, len, n; // ??????i,j?????len,????n int involution[5000]; // ????????????? memset(involution, 0, sizeof(involution)); // ????? cin >> n; // ??????? involution[0] = 1; // ???1??????1 len = 1; // ???????1 for (j = 1; j <= n; j++) // ????n? { for (i = 0; i < len; i++) // ???????*2??? { involution[i] *= 2; } // ??????????????9?????????? for (i = 0; i < len; i++) { if (involution[i] >= 10) { involution[i + 1] += involution[i] / 10; involution[i] %= 10; } } // ???????????????????????????????+1 if (involution[len] != 0) len++; } for (j = len - 1; j >= 0; j--) // ??????? cout << involution[j]; cout << endl; // ???? return 0; }
25
12,008
char a[2000]; int result[2000]; int temp[2000]; void calculate() { memset(result,0,sizeof(result)); int i = 0, j = 0; for(i = 0; i <= 1900; i++) { result[i] = temp[i] * 2 + result[i]; if(result[i] >= 10) { result[i+1] = result[i] / 10 + result[i+1]; result[i] = result[i] % 10; } } for(i = 0; i <= 1900; i++) { temp[i] = result[i]; } } int main() { memset(result,0,sizeof(result)); memset(temp,0,sizeof(temp)); temp[0] = 1; int n = 0, i = 0, j = 0; cin >> n; if(n == 0) cout << 1 << endl; else { for(i = 1; i <= n; i++) { calculate(); } for(i = 1900; i >= 0; i--) { if(result[i] != 0) break; } for(j = i; j >= 0; j--) { cout << result[j]; } cout << endl; } return 0; }
25
12,009
int main() { int N, i, j, flag = 0; cin >> N; int str[1000] = {0}; str[0] = 1; for (i = 0; i < N; i++) { for (j = 0; j < 1000; j++) str[j] = str[j] * 2; for (j = 0; j < 1000; j++) if (str[j] > 9) { str[j + 1] += str[j] / 10; str[j] = str[j] % 10; } } for (i = 999; i >= 0; i--) { if (str[i] != 0) flag = 1; if (flag) cout << str[i]; } return 0; }
25
12,010
int main() { int n,i,j,point,p; char str1[50],str2[50]; cin>>n; if(n==0) cout<<'1'<<endl; else { for(i=0;i<50;i++) { str1[i]='0'; str2[i]='0'; } str1[0]='1'; //??? for(i=1;i<=n;i++) { for(p=49;p>=0;p--) if(str1[p]!='0'||str2[p]!='0') { point=p+1; break; }//????? for(j=0;j<=point;j++) { str2[j+1]=((str1[j]-'0')*2+(str2[j]-'0'))/10+'0';//??????? str1[j]=((str1[j]-'0')*2+(str2[j]-'0'))%10+'0'; } } for(j=49;j>=0;j--) { if(str1[j]!='0') { point=j; break; } } for(j=point;j>=0;j--) cout<<str1[j]; cout<<endl; } return 0; }
25
12,011
int main() { int n, a[100] = {0}, l; cin >> n; a[0] = 1; l = 1; while (n--) { for (int i = 0; i < l; i++) { a[i] *= 2; } for (int i = 0; i < l; i++) { if (a[i] > 9) { a[i + 1]++; a[i] -= 10; } } if (a[l]) { l++; } } for (int i = l - 1; i >= 0; i--) { cout << a[i]; } cout << endl; return 0; }
25
12,012
char number[100]; int main() { number[0]='0'; int n; cin>>n; void power(int); if(n==0) cout<<"1"<<endl; else { power(n-1); int i; for(i=1;i<=strlen(number)-1;i++) cout<<number[i]; } return 0; } void power(int n) { if(n==0) number[1]='1'; else power(n-1); int len=strlen(number); int a[100]; a[len-1]=0; int i; for(i=len-1;i>=1;i--) { if(2*(number[i]-'0')+a[i]<=9) number[i]=2*(number[i]-'0')+a[i]+'0',a[i-1]=0; else number[i]=2*(number[i]-'0')+a[i]-10+'0',a[i-1]=1; } if(a[0]==1) number[0]='1'; else number[0]='0'; if(number[0]!='0') { for(i=len;i>=1;i--) number[i]=number[i-1]; number[0]='0'; } }
25
12,013
int main() {int b[2][100]={0}; b[0][0]=2; int n,i,j,k; cin>>n; if(n==0) cout<<"1"<<endl; else if(n==1) cout<<"2"<<endl; else{ for(i=1;i<n;i++) {k=90; while(b[0][k]==0)k--; for(j=0;j<=k+1;j++) {if(j!=0) {b[1][j]=b[0][j]*2+b[1][j-1]/10; b[0][j]=b[1][j]%10;} else {b[1][0]=b[0][0]*2; b[0][0]=b[1][0]%10; }}} k=90; while(b[0][k]==0)k--; for(;k>=0;k--) cout<<b[0][k];} return 0; }
25
12,014
int main() { char c[1000]; int m,i,j,a[1000],k; cin>>m; a[0]=2; if(m!=0) { for(i=1;i<1000;i++) { a[i]=0; } for(i=0;i<m-1;i++) { for(j=0;j<=1000;j++) { a[j]=a[j]*2; } for(j=0;j<1000;j++) { if(a[j]>9) { a[j]=a[j]%10; a[j+1]++; } } } i=999; while(a[i]==0)i--; for(k=i;k>=0;k--) { cout<<a[k]; } cout<<endl; } else cout<<"1"<<endl; return 0; }
25
12,015
/* * 2mi.cpp * * Created on: 2011-12-31 * Author: 2011 */ int main() { int n,i,s[100],j; for(i=0;i<100;++i) s[i]=0; s[0]=1; cin>>n; for(i=0;i<n;i++) { for(j=0;j<100;j++) { s[j]=2*s[j]; } for(j=0;j<100;j++){ if(s[j]>9) { s[j+1]=s[j+1]+1; s[j]=s[j]%10; }} } for(i=99;i>=0;i--) if(s[i]!=0) break; for(j=i;j>=0;j--) cout<<s[j]; cin>>n; return 0; }
25
12,016
int main() { int N, x[31] = {0}, i, r; x[0] = 1; cin >> N; while (N > 0) { r = 0; for (i = 0; i <= 30; i++) { int t = r; r = (x[i] * 2 + r) / 10; x[i] = (x[i] * 2 + t) % 10; } N--; } i = 30; while (x[i] == 0) i--; for (;i >= 0;i--) cout << x[i]; cout << endl; return 0; }
25
12,017
// // main.cpp // final // // Created by blues cookie on 13-1-11. // Copyright (c) 2013? blues cookie. All rights reserved. // int a[100]={1}; int len=1; void cal(int num) { if(num==0)return;int carrybit=0; int i; for(i=0;i<len;i++) { a[i]=a[i]*2+carrybit; carrybit=a[i]/10; a[i]=a[i]%10; } if(carrybit==1) { len++; a[i]=1; } cal(num-1); } int main() { int num; cin>>num; cal(num); for(int j=len-1;j>=0;j--) { cout<<a[j]; } }
25
12,018
//**************************************************** //* ????1000012846_2.cpp *********************** //* ????? ************************************* //* ????:2010?12? **************************** //* ???????2?N?? ************************* //**************************************************** //???????????Cheng,?????????????str[]??????????N void Cheng ( char str [40] , int N ) { if ( N == 1 ) //???????? cout << str ; else if ( N > 1 ) //??????2??? { int num1[40] = {0} , num2[40] , len = 0 , i = 0 , k = 40 ; len = strlen(str) ; for ( i = 0 ; i < len ; i++ ) //????????????? num1[i] = str[len-1-i] - '0' ; for ( i = 0 ; i < 40 ; i++ ) //???? num2[i] = num1[i] * 2 ; for ( i = 0 ; i < 40 ; i++ ) //???? { if ( num2[i] > 9 ) { num2[i] -= 10 ; num2[i+1] += 1 ; } } while ( num2[k-1] == 0 ) //??????????????? k-- ; for ( i = 0 ; i < k ; i++ ) //????????????? str[i] = num2[k-1-i] + '0' ; str[k] = '\0' ; Cheng(str,N-1) ; //?????? } } int main() { char str[40] = "2" ; //???????? int N ; cin >> N ; if ( N == 0 ) //?N=0?????1 cout << "1" << endl ; else Cheng ( str , N ) ; //???? return 0 ; }
25
12,019
int main(){ int n, num=1, i, j, flag=0; int a[50]={1}; cin >> n; for (i=1;i<=n;i++){ flag=0; for (j=0;j<num;j++){ a[j]=a[j]*2+flag; flag=0; if (a[j]>=10){ a[j]=a[j]-10; flag=1; } } if (flag==1){ a[num]=1; num++; } } for (i=num-1;i>=0;i--){ cout << a[i]; } }
25
12,020
int main() { int i, j, num, flag; int a[101]; cin >> num; memset(a, 0, sizeof(a)); a[100] = 1; while( num > 0 ) { flag = 0; for( i = 100; i >= 1; i-- ) { a[i] = a[i] * 2 + flag; if( a[i] >= 10 ) { a[i] -= 10; flag = 1; } else flag = 0; } num--; } i = 1; while( a[i] == 0 ) { i++; } for( j = i; j <= 100; j++ ) { cout << a[j]; } cout << endl; return 0; }
25
12,021
int main() { int n , len = 1; int num [50] = { 0 }, *p = num , carry = 0; num [ 0 ] = 1; cin >> n; while ( n -- ) { p = num; carry = 0; while ( p < num + len ) { *p *= 2; *p += carry; carry = 0; while ( *p > 9 ) { carry ++; *p -= 10; } p ++; } if ( carry ) { len ++; *p = carry; } } if ( *p == 0 ) p --; while ( p >= num ) { cout << *p; p --; } return 0; }
25
12,022
int main() { int n,i,cnt=0,len1=1,len2=1; cin >> n; char a[100]; a[0]=49; for(i=1; i<100; i++) { a[i]=48; } while(cnt<n) { for(i=len1-1; i>=0; i--) { if((a[i]-48)*2>=10) { a[i+1]+=1; if(i==len1-1) len2+=1; } a[i]=((a[i]-48)*2)%10+48; } len1=len2; cnt++; } for(i=len1-1; i>=0;i--) cout<<a[i]; return 0; }
25
12,023
int main() { int n,i,N; double total; total=1.0; scanf("%d",&N); if(N==0){ total=1;} if(N!=0){ for(i=0;i<N;i++){ total*=2; } } printf("%.0lf",total); scanf("%d",&n); return 0; }
25
12,024
int main(){ int n,i; double y,a; scanf("%d",&n); if(n>0){ a=1.0; for(i=0;i<n;i++){ y=a*2; a=y; } } if(n==0){ y=1.0; } printf("%.0lf",y); return 0; }
25
12,025
//???2?N??// //??????// //???1000011029// //???2010?12?21?// int main() { int n = 0; //????// char sum[101]; //???????// int i = 0; cin >> n; //????// char*p = &sum[1]; //????// memset(sum,'0',sizeof(sum) ); *p = '1'; for( i = 1;i <= n;i++ ) //?????????????,???// { p = &sum[100]; while(1) { if( ( *p - '0') * 2 >= 20 ) { (*( p + 1 )) += 2; *p = ( *p - '0') * 2 % 20 + '0'; } else if( ( *p - '0') * 2 >= 10 && ( *p - '0') * 2 < 20 ) { (*( p + 1 ))++; *p = ( *p - '0') * 2 % 10 + '0'; } else *p = ( *p - '0') * 2 + '0'; p--; if( p == &sum[0] ) break; } } for( i = 1;i <= 100;i++ ) //?????????// if( sum[i] - '0' >= 10 ) { sum[i + 1]++; sum[i] = sum[i] % 10; } for( i = 100;i >= 1;i-- ) //?????// if( sum[i] - '0' > 0 ) break; for( ;i > 0;i-- ) //??// cout << sum[i]; return 0; }
25
12,026
int a[100001]={0}; int main() { int N; cin>>N; int i,j,p,q,x; a[0]=2; if(N==0) { cout<<1; exit(1); } else { for(i=1;i<=N-1;i++) { for(j=0;j<1000;j++) { a[j]=a[j]+a[j]; } for(x=0;x<1000;x++) { if(a[x]>=10) { a[x]=a[x]-10; a[x+1]=a[x+1]+1; } } } } p=1000; while(a[p]==0) { p--; } for(q=p;q>=0;q--) cout<<a[q]; return 0; }
25
12,027
int a[510],b[510]; void function(); int main() { a[0]=2;b[0]=-1; for(int i=1;i<=500;i++){ a[i]=-1;b[i]=-1; } int n; cin>>n; if(n==0)cout<<"1"; else if(n==1)cout<<"2"; else { for(int j=1;j<n;j++) {function();} int lena; for(int i=0;i<=500;i++) if(a[i]==-1) {lena=i-1;break;} for(int i=lena;i>=0;i--) cout<<a[i]; } return 0; } void function() { int lena; for(int i=0;i<=500;i++) if(a[i]==-1){ lena=i-1;break; } //???a[],??0-lena for(int i=500;i>=500-lena;i--) {a[i]=a[500-i];b[i]=a[500-i];} //??a[],????b[] for(int i=500-lena;i<=500;i++){ a[i]=2*a[i]; if(a[i]>=10){ a[i]=a[i]-10; a[i-1]++; if(a[i-1]==0){a[i-1]++;lena++;}//????????????? } } for(int i=0;i<=lena;i++) {a[i]=a[500-i];b[i]=-1;} //??a[]????b[] }
25
12,028
void Multiply(int[50]); int main() { int n, num[50] = {0}, i; num[0] = 1; cin >> n; for(i = 1; i <= n; i++) { Multiply(num); } i = 49; while(num[i] == 0) i--; for(; i >= 0;) { cout << num[i--]; } return 0; } void Multiply(int num[50]) { int i; for(i = 0; i < 50; i++) { num[i] *= 2; } for(i = 0; i < 50; i++) { if(num[i] >= 10) { num[i + 1] += num[i] / 10; num[i] = num[i] % 10; } } return; }
25
12,029
int main(void) { char res[32]="0000000000000000000000000000001",temp[2]="0"; int n,i=0,j,c=0,t; scanf("%d",&n); for(;i<n;i++) { for(j=30;j>=0||(!c&&res[j]=='0');j--) { temp[0]=res[j]; t=atoi(temp)*2+c; res[j]=t%10+'0'; c=t/10; } } for(i=0;i<31&&res[i]=='0';i++); for(j=i;j<31;j++)res[j-i]=res[j];res[j-i]='\0'; printf("%s\n",res); return 0; }
25
12,030
//******************************** //*???5.??2?N?? ** //*?????? 1300017623 ** //*???2013.11.13 ** //******************************** int main() { int n, flag = 0, tag = 0; int a[100] = {1}; cin >> n; for (; n > 0; n--) for (int i = 0; i < 100; i++) { a[i] *= 2; if (flag) a[i]++; flag = 0; if (a[i] > 9) { flag = 1; a[i] -= 10; } } for (int i = 99; i >= 0; i--) { if (a[i] != 0 || tag) { tag = 1; cout << a[i]; } } return 0; }
25
12,031
int main() { int a[100][100] = {0}; int i, m, temp = 0, j; cin >> m; if(m == 0) { cout << 1; return 0; } a[0][99] = 2; for(i = 1 ; i < 100 ; i ++) { temp = 0; for(j = 99 ; j >= 0 ; j --) { temp = a[i - 1][j] + a[i - 1][j] + a[i][j]; if(temp > 9) a[i][j - 1] ++; a[i][j] = temp % 10; } } int flag = 0; for(i = 0 ; i < 100 ; i ++) { if(flag == 1) cout << a[m - 1][i]; if(a[m - 1][i] != 0 && !flag) { cout << a[m - 1][i]; flag = 1; } } return 0; }
25
12,032
int main() { int n; cin>>n; int w,s[100]; memset(s,0,sizeof(s)); w=1; s[1]=1; for (int i=1;i<=n;i++) { for (int j=1;j<=w;j++) s[j]*=2; for (int j=1;j<=w;j++) { s[j+1]=s[j+1]+s[j]/10; s[j]=s[j]%10; } if (s[w+1]>0) w++; } for (int i=w;i>=1;i--) cout<<s[i]; return 0; }
25
12,033
int main() { int n; cin >> n; int i,ans=1,j,k=1; int a[100]={0}; if(n==0) { cout << 1 << endl; } else { a[0]=1; int t=0; while(t<n) { t++; for(i=0;i<100;i++) { a[i]=a[i]*2; } for(i=0;i<100;i++) { if(a[i]>=10) { a[i+1]=a[i+1]+(a[i]/10); a[i]=a[i]%10; } } } j=99; while(a[j]==0) { j--; } for(;j>=0;j--) { cout << a[j]; } cout << endl; } cin.get();cin.get();cin.get(); return 0; }
25
12,034
int main() { int i, j, len = 1, n; int ans[50] = {0}; cin >> n; ans[0] = 1; for (i = 0; i < n; i++) { for (j = 0; j < len; j++) { ans[j] = ans[j] * 2; } for (j = 0; j < len; j++) { if (ans[j] > 9) { ans[j] -= 10; ans[j + 1] += 1; if (j == len - 1) { len++; break; } } } } for (i = 0; i < len; i++) { cout << ans[len - i - 1]; } return 0; }
25
12,035
int main() { int n,ans=2,i,k=0,p; char num[1000]; int m[1000]={0},result[1000]={0}; cin>>n; if(n==0) cout<<"1"<<endl; else if(n<31) { for(i=1;i<n;i++) { ans=ans*2; } cout<<ans<<endl; } else { for(i=1;i<30;i++) { ans=ans*2; } for(int y=0;y<1000;y++) { num[k++]=ans%10; ans=ans/10; } for(int l=30;l<n;l++) { for(i=0;i<1000;i++) { result[i]=0; } for(i=0;i<1000;i++) { result[i]=result[i]+num[i]*2; if(result[i]>=10) { result[i]=result[i]%10; result[i+1]+=1; } } for(i=0;i<1000;i++) { num[i]=result[i]; } } for(i=999;i>=0;i--) { if(result[i]!=0) {p=i;break;} } for(i=p;i>=0;i--) { cout<<result[i]; } } return 0; }
25
12,036
//Name: ??2?N??.# //Author: ?? # //Number:1000062710 # //Date:2010?12?15?# //#################### int main() { int N,i; cin >> N; int a[400] = {0}; a[399] = 1; for(i = 0; i < N; i++) { for(int j = 0; j < 400; j++) { a[j] = a[j] * 2; } for(int k = 399; k >= 0; k--) { if(a[k] >= 10) { a[k] = a[k] - 10; a[k - 1]++; } } } for(i = 0; i < 400; i++) { if(a[i] != 0) break; } for(int j = i; j < 400; j++) { cout << a[j]; } cout << endl; return 0; }
25
12,037
int main() { int s[50]={0},t=0;s[0]=2; int n; cin>>n; int i=0,j=0; if(n==0) cout<<"1"; else{ for(i=0;i<n-1;i++) { t=0; for(j=0;j<50;j++) { s[j]=s[j]*2; s[j]=s[j]+t; if(s[j]>9) {s[j]=s[j]-10;t=1;} else t=0; } } for(j=49;j>=0;j--) if(s[j]>0) break; for(i=j;i>=0;i--) cout<<s[i];} return 0; }
25
12,038
/************************************* *file 5.cpp ****** *author ??? **** *date 2013-11-19 *** *description 2?n?? * *************************************/ int main() { int n; cin >> n; //????? int c[200] = {0}; //?????????? c[0] = 1; //??2?0????? int i, j, k; int m = 0; //??????????????-1 for(i = 1; i <= n; i++) { //???? for(j = 0; j <= m; j++) { c[j]*=2; //?????????2? } //???? for(j = 0; j <= m; j++) //?????? { if(c[j] >= 10) { c[j]-=10; c[j + 1]++; } } if(!c[m + 1]) //???m??????????0? m++; } int o = 0; //0???????????? for(i = 199; i >= 0; i--) { if(c[i]) //??????? { cout << c[i]; o = 1; } else if(o) //?????????????????? cout << c[i]; } cout << endl; return 0; }
25
12,039
int main () { char ch[50] = {'1'}; for ( int i = 1; i < 50; i ++ ) ch[i] = '0'; int n; cin >> n; int temp = 0; for ( int i = 1; i <= n; i ++ ) { for ( int j = 0; j < 50; j ++ ) { ch[j] = (ch[j]-'0')*2+temp; if ( ch[j] > 9 ) { temp = 1; ch[j] = ch[j] - 10 + '0'; } else { temp = 0; ch[j] = ch[j] + '0'; } } } for ( int i = 49; i >= 0; i -- ) { if ( ch[i] != '0' ) { temp = i; break; } } for ( int i = temp; i >= 0; i -- ) cout << ch[i]; return 0; }
25
12,040
//******************************** //*??2?N?? ** //*????? 1300012848 ** //*???2013.11.16 ** //******************************** int main() { const int MAX_LEN = 200; int n, i, j, k = MAX_LEN; int a[MAX_LEN + 1]; memset(a,0,sizeof(a)); //???? cin >> n; if (n == 0) cout << "1" << endl; //2?0???1 else { a[0] = 1; for (i = 1; i <= n; i++) //????n? { for (j = 0; j < MAX_LEN; j++) //?????????? a[j] = a[j] * 2; for (j = 0; j < MAX_LEN; j++) //??????????????? if(a[j] >= 10) { a[j] = a[j] % 10; //???10?? a[j+1]++; //????? } } while (a[k] == 0) k--; for(; k >= 0; k--) cout << a[k]; //????? ????????0?? ???? } return 0; }
25
12,041
int main() { int a[1001]; memset(a,0,sizeof(a)); int i,j,k,n; int p = 0; cin >> n ; a[1] = 2 ; if(n == 0) { cout << "1"; } else { for(i = 1; i< n; i++) { p = 0; for(j = 1; j <=1000; j ++) { a[j] = a[j] * 2 + p ; p = a[j] / 10; a[j] = a[j] % 10; } } for( i = 1000; a[i] == 0 ; i-- ); k = i ; for(i = k ;i >= 1 ; i -- ) { cout<<a[i]; } } return 0 ; }
25
12,042
int main() { int n, num[35], i, j; memset(num, 0, sizeof(num)); cin >> n; if(n != 0) { num[0] = 2; for(i = 1; i < n; i++) { for(j = 0; j < 35; j++) num[j] *= 2; for(j = 0; j < 35; j++) { if(num[j] >= 10) { num[j + 1] += num[j] / 10; num[j] = num[j] % 10; } } } i = 34; while(num[i] == 0) i--; for( ; i >= 0; i--) cout << num[i]; cout << endl; } if(n == 0) cout << 1 << endl; return 0; }
25
12,043
int main(){ int n; cin>>n; if(n==0){ cout<<1<<endl;return 0; } n--; static int a[1000],b[1000]; for(int i=0;i<1000;i++)a[i]=0; a[0]=1;a[1]=2; while(n){ n--; for(int i=0;i<1000;i++)b[i]=0; b[0]=a[0]; for(int i=1;i<=a[0];i++){ b[i]+=a[i]*2; b[i+1]+=b[i]/10; b[i]%=10; } if(b[a[0]+1]>0)b[0]++; for(int i=0;i<1000;i++)a[i]=b[i]; } for(int i=a[0];i>=1;i--){ cout<<a[i]; } cout<<endl; return 0; }
25
12,044
int main(){ int n,i,j,m,t; cin>>n; int a[1000]={0}; a[0]=2; for(i=0,t=1;i<n-1;i++){ for(j=0,m=0;j<t;j++){ a[j]=a[j]+a[j]+m; if(a[j]>9){ a[j]=a[j]-10; m=1; t++; } else m=0; } } for(i=99;i>0;i--) if(a[i]!=0) break; for(j=i;j>=0&&n!=0;j--) cout<<a[j]; if(n==0) cout<<"1"; cout<<endl; return 0; }
25
12,045
int a[101],b[101];//b?????? int n; void f(int i) { int j; if(i==n) return; else { for(j=0;j<101;j++) b[j]=0; for(j=100;j>=0;j--) { a[j]=a[j]*2+b[j];//???? if(a[j]>=10) {a[j]=a[j]-10; b[j-1]=1;} } f(i+1); } } int main() { cin>>n; a[100]=1; f(0); int i; for(i=0; ;i++) { if(a[i]!=0) break; } for(i;i<=100;i++) cout<<a[i]; }
25
12,046
int main() { int n; cin >> n; char a[200] = {0}, b[200] = {0} ; int c[200] = {0}, d[200] = {0}; a[0] =1 + '0'; int i=0; char *p=a; while(i<n) { int j =0; while( j<strlen(a) ) { c[j] = a[j] - '0'; j++; } j=0; while (j<strlen(a)) { c[j] = c[j]*2; j++; } j=0; while (j<strlen(a)+1) { c[j+1] += (c[j]/10); c[j] %= 10 ; j++; } j=199; while(c[j] == 0) j--; while ( j >= 0) { a[j] = c[j] + '0'; j--; } i++; } i=0; for( i=strlen(a)-1; i>=0; i--) { cout << a[i]; } return 0; }
25
12,047
char a[1000] = {'0'}; int len; void mul(char a[]) { len = strlen(a); int b[1000] = {0}; for (int i = 0; i < len; i ++) { b[i] = 2 * (a[i] - '0'); } for (int i = 0; i < len; i ++) { b[i + 1] = b[i + 1] + b[i] / 10; b[i] = b[i] % 10; a[i] = b[i] + '0'; a[i + 1] = b[i + 1] + '0'; } } int main() { int n; cin >> n; a[0] = '2'; a[1] = '\0'; if (n == 0) { cout << "1" << endl; } else { for (int i = 1; i < n; i ++) { mul(a); } int i = len; while (a[i] == '0') { i --; } for (int j = i; j >= 0; j --) { cout << a[j]; } cout << endl; } return 0; }
25
12,048
int main() { char a[1001]; a[0] = '2'; int b, i, j, k = 0, k1 = 0; cin >> b; if (b == 0) cout << "1" << endl; else { for (i = 1; i < 1001; i++) a[i] = '0'; for (i = 1; i < b; i++) { for (j = 0; j <1001; j++) { k = (a[j] - '0') * 2 / 10; a[j] = (a[j] - '0') * 2 % 10 + k1 + '0'; k1 = k; } } k = 0; for(i = 1000; i >= 0; i--) { if (a[i] !='0') k = 1; if (k == 1) cout << a[i]; } cout << endl; } return 0; }
25
12,049
void everydouble(int a[]) { int i; for (i=0;i<=99;i++) a[i]*=2; } void moveahead(int a[]) { int i; for (i=0;i<=99;i++) { if (a[i]>=10) {a[i]-=10;a[i+1]++;} } } void print(int a[]) { int flag=0,i; for (i=0;i<=99;i++) { if (a[i]!=0) flag=i; } for (i=flag;i>=0;i--) printf("%d",a[i]); } int main(int argc, char *argv[]) { int n,i,j; scanf("%d",&n); int a[100]; a[0]=1; for (i=1;i<=99;i++) a[i]=0; for (i=0;i<=n-1;i++) { everydouble(a); moveahead(a); } print(a); return 0; }
25
12,050
/* * 2Npower.cpp * ?????2?N?? * Created on: 2013-1-11 * Author: ??? */ void operate(int N); int main() { int N; //????? cin>>N; //????? operate(N); //????operate return 0; } void operate(int N) { int i,j; int num=0; int result[51]; //???? memset(result,0,sizeof(result));//??? if(N==0){ cout<<'1'; return ;} result[50]=2; //???? for(i=2;i<=N;i++) { for(j=50;j>=0;j--) { result[j]=result[j]*2+num; if(result[j]>=10){ result[j]=result[j]-10; num=1; } else num=0; } } for(i=0;i<=50;i++) //????? if(result[i]!=0) break; for(j=i;j<=50;j++) //?? cout<<result[j]; return ; }
25
12,051
//*************************** //?????? 1200012896 ** //???2012.12.23 ** //?????2?N?? ** //*************************** int main() { int n; cin >> n; switch (n) { case 0: cout << "1" << endl; break; case 1: cout << "2" << endl; break; case 2: cout << "4" << endl; break; case 3: cout << "8" << endl; break; case 4: cout << "16" << endl; break; case 5: cout << "32" << endl; break; case 6: cout << "64" << endl; break; case 7: cout << "128" << endl; break; case 8: cout << "256" << endl; break; case 9: cout << "512" << endl; break; case 10: cout << "1024" << endl; break; case 11: cout << "2048" << endl; break; case 12: cout << "4096" << endl; break; case 13: cout << "8192" << endl; break; case 14: cout << "16384" << endl; break; case 15: cout << "32768" << endl; break; case 16: cout << "65536" << endl; break; case 17: cout << "131072" << endl; break; case 18: cout << "262144" << endl; break; case 19: cout << "524288" << endl; break; case 20: cout << "1048576" << endl; break; case 21: cout << "2097152" << endl; break; case 22: cout << "4194304" << endl; break; case 23: cout << "8388608" << endl; break; case 24: cout << "16777216" << endl; break; case 25: cout << "33554432" << endl; break; case 26: cout << "67108864" << endl; break; case 27: cout << "134217728" << endl; break; case 28: cout << "268435456" << endl; break; case 29: cout << "536870912" << endl; break; case 30: cout << "1073741824" << endl; break; case 31: cout << "2147483648" << endl; break; case 32: cout << "4294967296" << endl; break; case 33: cout << "8589934592" << endl; break; case 34: cout << "17179869184" << endl; break; case 35: cout << "34359738368" << endl; break; case 36: cout << "68719476736" << endl; break; case 37: cout << "137438953472" << endl; break; case 38: cout << "274877906944" << endl; break; case 39: cout << "549755813888" << endl; break; case 40: cout << "1099511627776" << endl; break; case 41: cout << "2199023255552" << endl; break; case 42: cout << "4398046511104" << endl; break; case 43: cout << "8796093022208" << endl; break; case 44: cout << "17592186044416" << endl; break; case 45: cout << "35184372088832" << endl; break; case 46: cout << "70368744177664" << endl; break; case 47: cout << "140737488355328" << endl; break; case 48: cout << "281474976710656" << endl; break; case 49: cout << "562949953421312" << endl; break; case 50: cout << "1125899906842624" << endl; break; case 51: cout << "2251799813685248" << endl; break; case 52: cout << "4503599627370496" << endl; break; case 53: cout << "9007199254740992" << endl; break; case 54: cout << "18014398509481984" << endl; break; case 55: cout << "36028797018963968" << endl; break; case 56: cout << "72057594037927936" << endl; break; case 57: cout << "144115188075855872" << endl; break; case 58: cout << "288230376151711744" << endl; break; case 59: cout << "576460752303423488" << endl; break; case 60: cout << "1152921504606846976" << endl; break; case 61: cout << "2305843009213693952" << endl; break; case 62: cout << "4611686018427387904" << endl; break; case 63: cout << "9223372036854775808" << endl; break; case 64: cout << "18446744073709551616" << endl; break; case 65: cout << "36893488147419103232" << endl; break; case 66: cout << "73786976294838206464" << endl; break; case 67: cout << "147573952589676412928" << endl; break; case 68: cout << "295147905179352825856" << endl; break; case 69: cout << "590295810358705651712" << endl; break; case 70: cout << "1180591620717411303424" << endl; break; case 71: cout << "2361183241434822606848" << endl; break; case 72: cout << "4722366482869645213696" << endl; break; case 73: cout << "9444732965739290427392" << endl; break; case 74: cout << "18889465931478580854784" << endl; break; case 75: cout << "37778931862957161709568" << endl; break; case 76: cout << "75557863725914323419136" << endl; break; case 77: cout << "151115727451828646838272" << endl; break; case 78: cout << "302231454903657293676544" << endl; break; case 79: cout << "604462909807314587353088" << endl; break; case 80: cout << "1208925819614629174706176" << endl; break; case 81: cout << "2417851639229258349412352" << endl; break; case 82: cout << "4835703278458516698824704" << endl; break; case 83: cout << "9671406556917033397649408" << endl; break; case 84: cout << "19342813113834066795298816" << endl; break; case 85: cout << "38685626227668133590597632" << endl; break; case 86: cout << "77371252455336267181195264" << endl; break; case 87: cout << "154742504910672534362390528" << endl; break; case 88: cout << "309485009821345068724781056" << endl; break; case 89: cout << "618970019642690137449562112" << endl; break; case 90: cout << "1237940039285380274899124224" << endl; break; case 91: cout << "2475880078570760549798248448" << endl; break; case 92: cout << "4951760157141521099596496896" << endl; break; case 93: cout << "9903520314283042199192993792" << endl; break; case 94: cout << "19807040628566084398385987584" << endl; break; case 95: cout << "39614081257132168796771975168" << endl; break; case 96: cout << "79228162514264337593543950336" << endl; break; case 97: cout << "158456325028528675187087900672" << endl; break; case 98: cout << "316912650057057350374175801344" << endl; break; case 99: cout << "633825300114114700748351602688" << endl; break; case 100: cout << "1267650600228229401496703205376" << endl; break; default : cout << "??????????????" << endl; } return 0; }
25
12,052
/** * @file 5.cpp * @author ??? * @date 2013-11-13 * @description ?????????2?N?? */ int main(void) { int N, a[100] = {0}, i, k; a[99] = 1; cin >> N; for( i = 0 ; i < N ; i++ ) { for( k = 1 ; k <= 100 ; k++ ) a[100 - k] *= 2; for( k = 1 ; k <= 100 ; k++ ) if( a[100 - k] > 9 ) { a[99 - k] += a[100 - k] / 10; a[100 - k] %= 10; } } for( k = 0 ; k < 100 ; k++ ) if( a[k] ) break; for( ; k < 100 ; k++ ) cout << a[k]; return 0; }
25
12,053
int main() { int n,i; double a=1.0; scanf("%d",&n); for(i=1;i<=n;i++){ a=a*2; } printf("%.0lf",a); scanf("%d",&n); return 0; }
25
12,054
int main() { char a[100]; int j, n, i, k = 0; a[0] = 2; for(i = 1; i < 100; i++) a[i] = 0; cin >> n; if(n == 0) cout << "1" <<endl; else {for(j = 0; j < n - 1;j++) { int flag = 1; for(i = 0; i < 100; i++) { if(flag) { if((a[i] - 0) * 2 < 10) a[i] = (a[i] - 0) * 2; else { a[i] = ((a[i] - 0) * 2) % 10 ; flag = 0; } } else { if(((a[i] - 0) * 2 + 1) < 10) { a[i] = (a[i] - 0) * 2 + 1; flag = 1; } else { a[i] = ((a[i] - 0) * 2 )% 10 + 1; flag = 0; } } } } for(i = 99; i >= 0; i--) { if(a[i] != 0) k = 1; if(k) cout << a[i] - '0' + 48; } } return 0; }
25
12,055
int main() { int n, i = 0, x, y, m; char s[300], a[300]; cin >> n; s[0] = '1'; for(;n > 0;n--) { x = y = 0; m = i + 1; m--; for(i = 0; i <= m; i++) { y = x + (s[m - i] - '0') * 2; a[i] = y % 10 + '0'; x = y / 10; } if(x != 0) a[i] = x + '0'; else i--; for(m = 0; m <= i; m++) s[m] = a[i - m]; } for(m = 0; m <=i ; m++) cout << s[m]; return 0; }
25
12,056
int main(){ int n,i,j,b[1000]; scanf("%d",&n); b[0]=1; for(i=1;i<1000;i++){ b[i]=0; } for(i=0;i<n;i++){ j=1; b[0]=b[0]*2; for(j=1;1;j++){ if(b[j]==0&&b[j+1]==0&&b[j+2]==0){ b[j]=b[j-1]/10; b[j-1]=b[j-1]%10; break; } b[j]=b[j]*2+b[j-1]/10; b[j-1]=b[j-1]%10; } } if(n!=0){ if(b[j]==0){ j=j-1; } for(i=j;i>=0;i--){ printf("%d",b[i]); } } if(n==0){ printf("1"); } return 0; }
25
12,057
int main() { int num[1000]={0},k=0,i=0,j=0,s=0; num[0]=1; cin>>k; for(i=0;i<k;i++) { for(j=0;j<1000;j++) num[j]*=2; for(j=0;j<1000;j++) { num[j+1]+=num[j]/10; num[j]=num[j]%10; } } for(i=999;i>=0;i--) { if(num[i]!=0)s++; if(s>0)cout<<num[i]; } return 0; }
25
12,058
int main () { char a[100]={0}; a[99]=2; int n; cin >>n; for (int j=1;j<=n-1;j++) { for (int i=99;i>=0;i--) { a[i]=a[i]*2; } for (int i=99;i>=0;i--) { if (a[i]>=10) { a[i]=a[i]-10; a[i-1]=a[i-1]+1; } } } int m=0; for (int i=0;i<=99;i++) { if (a[i]!=0) { m=i; break; } } if (n!=0) { for (int i=m;i<=99;i++) putchar(a[i]+48); } else cout <<"1"; return 0; }
25
12,059
int main() { int a1[102],i,a3[102]; memset(a1,0,sizeof(a1)); memset(a3,0,sizeof(a3)); a1[0]=1; int n; cin >> n; while(n-->0) { for(i=0;i<101;i++) { a3[i]+=a1[i]*2; if(a3[i]>=10) { a3[i+1]++; a3[i]=a3[i]%10; } } for(i=0;i<101;i++) a1[i]=a3[i]; memset(a3,0,sizeof(a3)); } i=101; while(a1[i]==0) { i--; } for(;i>=0;i--) cout << a1[i]; cout << endl; return 0; }
25
12,060
int main() { int n, i, j, count = 0; cin >> n; int a[100]; for(i = 0; i < 99; i++) a[i] = -1; a[99] = 1; if(n == 0) cout << 1; else { for(i = 0; i < n; i++) { count = 0; for(j = 99; j >= 0; j--) if(a[j] != -1) { count++; } for(j = 99; j > 99 - count; j--) a[j] = a[j] * 2; for(j = 99; j > 99 - count; j--) { if(a[j] >= 10) { a[j] = a[j] - 10; if(a[j - 1] == -1) { a[j - 1] = 1; count++; break; } else a[j - 1] = a[j - 1] + 1; } } } } for(i = 99 - count + 1; i <= 99; i++) cout << a[i]; cout << endl; return 0; }
25
12,061
/** * ?????? * ???1000012844 * ?????2?N?? **/ void multiply( char str[], int n ); int main() { int N; char str[ 200 ] = "1"; cin >> N; while ( N > 0 ) { multiply( str, 2 ); N--; } cout << str << endl; return 0; } void multiply( char str[], int n ) { int num[ 200 ]; int jump = 0, temp; memset( num, 0, sizeof( num ) ); char *sPtr = str + strlen( str ) - 1; int *nPtr = num + 199; while( sPtr != str - 1 ) { *nPtr-- = *( sPtr-- ) - '0'; } nPtr = num + 199; while ( nPtr != num - 1 ) { temp = *nPtr * n % 10 + jump; jump = *nPtr * n / 10; *nPtr-- = temp; } nPtr = num; sPtr = str; while ( *nPtr == 0 ) { nPtr++; } while ( nPtr != num + 200 ) { *sPtr++ = *nPtr++ + '0'; } *sPtr = 0; }
25
12,062
char p[200]={'1'},temp[200]={0}; //???????? void sq() //????2 {int i,j,jinwei=0; for(i=0;p[i]!='\0';i++) {temp[i]=((p[i]-'0')*2+jinwei)%10+'0'; //??? jinwei=((p[i]-'0')*2+jinwei)/10; //?? } temp[i]=jinwei+'0'; //??? for(i=0;i<200;i++) {p[i]=temp[i];temp[i]=0;} //??????? } int main() {int i,j,n; cin>>n; for(i=0;i<n;i++) sq(); for(i=199;p[i]=='\0'||p[i]=='0';i--); //??????????????? for(;i>=0;i--) cout<<p[i]; return 0; }
25
12,063
int main() { int n, i = 0, k; cin >> n; int num[40] = {0}; int mirror[40] = {0}; num[39] = 1; mirror[39] = 1; if (n == 0) cout << 1 << endl; else { for (i = 1; i <= n; i++) { for (k = 39; k >= 0; k--) { num[k] = num[k] + mirror[k]; if (num[k] >= 10) { num[k] = num[k] - 10; num[k - 1]++; } } for (k = 0; k <= 39; k++) mirror[k] = num[k]; } k = 0; while (num[k] == 0 ) k++; for (k; k <= 39; k++) cout << num[k]; cout << endl; } return 0; }
25
12,064
int x[10000]={0}; int b=1; void f(int a,int n){ int i; if(n==1); else { for(i=0;i<a;i++)x[i]=x[i]*2; for(i=0;i<a;i++){ if(i<a-1){ if(x[i]>=10){ x[i]-=10; x[i+1]+=1;} } else { if(x[i]<10)f(a,n-1); else {x[i+1]=1; x[i]-=10; b++; f(a+1,n-1); } } }} } int main() { int i,j,n,a,q,m,g,k,h; scanf("%d",&n); if(n==0)printf("1"); else{ x[0]=2; f(1,n); for(i=b-1;i>=0;i--){ printf("%d",x[i]);} } }
25
12,065
int main() { int a[50] = {0}; int n, i, j, carry, temp; cin >> n; a[0] = 1; for (i = 1;i <= n;i++) { carry = 0; for (j = 0;j < 49;j++) { temp = floor(a[j] * 2 / 10); a[j] = (a[j] * 2) % 10; a[j] += carry; carry = temp; } } temp = 0; for (i = 0;i < 49;i++) if (a[i] != 0) temp = i; for (j = temp;j >= 0;j--) cout << a[j]; cout << endl; return 0; }
25
12,066
int main () { int i,j,k,n, remain = 0, index; int ans[100000] = {1,0}; cin >> n; for (i = 0; i < n; i++) { remain = 0; for (j = 0; j < 100000; j++) { ans[j] = 2*ans[j] + remain; remain = ans[j] /10; ans[j] = ans[j] %10; } } index = 99999; while (ans[index] == 0) index--; for (i = index; i >= 0; i--) cout << ans[i]; cout << endl; }
25
12,067
int main() { int n; cin>>n; int a[1001]={0}; a[1000]=1; int i,j; while(n--) { for(i=1000;i>0;i--) a[i]*=2; //????????*2 for(i=1000;i>0;i--) { if(a[i]>=10) //????????????10??? { a[i]-=10; a[i-1]+=1; } } } for(i=0;i<=1000;i++) { if(a[i]!=0) { for(j=i;j<=1000;j++) //?? cout<<a[j]; break; } } return 0; }
25
12,068
int main(){ int n,i,c,j; scanf("%d",&n); int sz[100]={1,0}; c=0; for(j=0;j<n;j++){ for(i=0;i<100;i++){ sz[i]=sz[i]*2+c; if(sz[i]>=10){ sz[i]-=10; c=1; }else{ c=0; } } } i=99; while(sz[i]==0){ i--; } for(;i>=0;i--){ printf("%d",sz[i]); } return 0; }
25
12,069
/* *@ title:??2?N?? *@ date:2010-12-15 *@ author:1000012899 ??? *@ description: ????? */ int main() { int n, i, j; unsigned s; int sum[40] = {8, 4, 6, 3, 8, 4, 7, 4, 1, 2}; cin >> n; if (n <= 31) { s = 1; for (i = 1; i <= n; i++) s = s * 2; cout << s; } else { for (i = 1; i <= n - 31; i++) { for (j = 0; j < 39; j++) sum[j] = sum[j] * 2; for (j = 0; j <= 39; j++) { sum[j+1] = sum[j] / 10 + sum[j+1]; sum[j] = sum[j] % 10; } } i = 39; while(sum[i] == 0) { i--;} for (j = i; j >= 0; j--) cout << sum[j]; } return 0; }
25
12,070
int main() { int n,flag =0; cin >> n; int a[100] ={0}; a[0] = 1; int i,j; for (i = 1;i <=n; i++) { for(j =0;j<=99;j++) a[j] = a[j]*2; for(j = 0; j<=99;j++) { if (a[j] >=10) { a[j+1] = a[j+1]+(a[j]-a[j]%10)/10; a[j] = a[j]%10; } } } for(i =99; i>=0;i--) { if(a[i]!=0 ||flag) { flag =1; cout <<a[i]; } } return 0; }
25
12,071
int main() { int n,sum = 1, i, j, temp = 0, l; cin >> n; char str[40]; for(i = 0; i < 40; i++) { str[i] = '0'; } str[0] = '1'; for(i = 1; i <= n; i++) { temp = 0; for(j = 0; j < 40; j++) { if(2 * (str[j] - '0') + temp >= 10) { str[j] = 2 * (str[j] - '0') - 10 + temp + '0'; temp = 1; } else { str[j] = 2 * (str[j] - '0') + temp + '0'; temp = 0; } } } for(i = 0; i < 40; i++) { if(str[i] == '0' && str[i + 1] == '0' && str[i + 2] == '0') { l = i;break; } } for(i = l - 1; i >= 0;i--) { cout << str[i]; } return 0; }
25
12,072
int main() { int a[101]={0},b[101]={0},I=0; a[0]=1; int n; cin>>n; for(int j=1;j<=n;j++) { for(int i=0;i<101;i++) { a[i]=a[i]*2; if(a[i]>=10) { a[i]-=10; b[i+1]++; } } for(int i=0;i<101;i++) { a[i]=a[i]+b[i]; b[i]=0; } } for(int i=99;i>=0;i--) { if(a[i]!=0)I++; if(I>0) cout<<a[i]; } return 0; }
25
12,073
int a[102]={0},ans[102]={0}; int j; void mult(int a[]) { for(j=0;j<101;j++) { a[j]=a[j]*2;} for(j=0;j<101;j++){ a[j+1]=a[j+1]+a[j]/10; a[j]=a[j]%10;} } int main() { int n,i; cin>>n; a[0]=1; for(i=0;i<n;i++) { mult(a); } int k=100; while(a[k]==0) k--; for(i=k;i>=0;i--) cout<<a[i]; return 0; }
25
12,074
int main() { int b[100] = {0}; int n,i,count = 0,k = 1,j,flag = 0; cin >> n; b[0] = 1; for (j = 1;j <= n;j++) { for (i = 0;i < k;i++) b[i] = b[i] * 2; for (i = 0;i < k;i++) { if (i == k - 1 && b[i] >= 10) k++; if (b[i] >= 10) { b[i] = b[i] - 10; b[i + 1]++; } } } for (i = 99;i >= 0;i--) { if (b[i] != 0) count = 1; if (count) cout << b[i]; } return 0; }
25
12,075
//******************************** //* ??????2?N?? * //* ?????? * //* ???2010-12-16 * //* ?????2?N?? * //******************************** void product(int res[200], int N) { int i, j; for(i = 1; i <= N; i++) { for(j = 0; j < 199; j++) { res[j] = res[j] * 2; } for(j = 0; j < 199; j++) if(res[j] >= 10) { res[j + 1] += res[j] / 10; res[j] = res[j] % 10; } } for(i = 199; i >= 0; i--) if(res[i] != 0) { for(j = i; j >= 0; j--) { cout << res[j]; } break; } return; } int main() { int res[200] = {1}; int N; for(int i = 1; i < 200; i++) res[i] = 0; cin >> N; if(N == 0) cout << '1' << endl; else product(res, N); return 0; }
25
12,076
int main() { int num[10000] = {0}; int n = 0; cin >> n; num[0] = 1; num[1] = 1; for (; n > 0; n--) { for (int i = 1; i <= num[0]; i++) num[i] *= 2; for (int i = 1; i <= num[0]; i++) { num[i+1] += num[i] / 10; num[i] = num[i] % 10; } if (num[num[0]+1] > 0) num[0] ++; } for (int i = num[0]; i > 0; i--) cout << num[i]; return 0; }
25
12,077
int main() { int n; cin >> n; char c[50]; c[49] = '1'; for(int i =0 ;i<49;i++) c[i] = '0'; for(int i = 0;i<n;i++) { int t = 0; for(int j = 49;j>0;j--) { c[j] += c[j]+t-'0'; if( c[j] > '9') { c[j] -= 10; t = 1; } else t =0; } } int i = 0; while(c[i] <='0') i ++; for(int j = i; j < 50;j++) cout<<c[j]; cout<<endl; return 0; }
25
12,078
int main() { int n, a[1000] = {0}; cin >> n; if (n == 0)//???0 cout << "1"; else { a[0] = 1; int t, l = 1; for (int i = 0; i < n; i++) { for (int j = l-1; j >= 0; j--) { a[j] = 2 * a[j]; if (a[j] > 9)//?? { t = a[j]; a[j] = a[j] % 10; a[j+1] = a[j+1] + 1; if(j+1 == l) {l++; break;} l++; } } } } int flag = 0; for (int m = 999; m >= 0; m--) { if (a[m] != 0 || flag != 0) cout << a[m], flag = 1; } return 0; }
25
12,079
int main() { int n,i,j,k=1; int b[200]={1},c[200]={0}; cin>>n; for(i=0;i<n;i++) { for(j=0;j<=k;j++) c[j]=0; for(j=0;j<k;j++) { c[j]+=2*b[j]; c[j+1]+=c[j]/10; c[j]=c[j]%10; } if(c[k]) k++; for(j=0;j<k;j++) b[j]=c[j]; } for(i=k-1;i>=0;i--) cout<<b[i]; cout<<endl; return 0; }
25
12,080
/*???????2?N?? *?????? *???2010/12/16 *???1000010449 */ void multiply(char *p) { int num[70], i = 0, end; num[0] = 0; while (*(p + i) != '\0') { num[i + 1] = 2 * (*(p + i) - '0'); i++; } end = i; for (i = end; i > 0; i--) { num[i - 1] += num[i] / 10; num[i] %= 10; } if (num[0] == 0) i = 1; else i = 0; while (i <= end) *p++ = num[i++] + '0'; *p = '\0'; return; } int main() { char result[71] = "1"; int n, i; cin >> n; for (i = 0; i < n; i++) multiply(result); cout << result << endl; return 0; }
25
12,081
// * * * * * * * * * * * * * * * // *?????2?N?? * // *?????? 1300013011 * // *???2013.11.17 * // * * * * * * * * * * * * * * * int main() { int n, num[1000] = {0}, i, j, len; cin >> n; num[0] = 1; // ??????????1????0 for (i = 1; i <= n; i++) { for (j = 999; j >= 0; j--) { if (num[j] != 0) { len = j; // ????0??????? break; } } for (j = 0; j <= len; j++) num[j] *= 2; // ??????0???????2 for (j = 0; j <= len; j++) { if (num[j] >= 10) // ?????????9???????? { num[j + 1] += num[j] / 10; num[j] = num[j] % 10; } } } for (j = 999; j >= 0; j--) // ??????????0?? { if (num[j] != 0) { len = j; break; } } for (i = len; i >= 0; i--) // ??????0???????? cout << num[i]; cout << endl; return 0; }
25
12,082
//******************************** //*??2?N?? ** //*????? 1300012848 ** //*???2013.11.16 ** //******************************** int main() { const int MAX_LEN = 200; int n, i, j, k = MAX_LEN , jinwei[MAX_LEN + 1], flag[MAX_LEN + 1] = {0}; int a[MAX_LEN + 1]; memset(jinwei,0,sizeof(jinwei)); memset(a,0,sizeof(a)); memset(flag,0,sizeof(flag)); cin >> n; if (n == 0) cout << "1" << endl; else { a[0] = 1; for (i = 1; i <= n; i++) { for (j = 0; j < MAX_LEN; j++) a[j] = a[j] * 2; for (j = 0; j < MAX_LEN; j++) if(a[j] >= 10) { a[j] = a[j] % 10; a[j+1] ++; } } while (a[k] == 0) k--; for(; k >= 0; k--) cout << a[k]; } return 0; }
25
12,083
int main() { int x[50]; int m; cin>>m; int n=40; int i; x[0]=1; for(i=1;i<n;i++) { x[i]=0; }//???? for(int r=0;r<m;r++) { for(i=0;i<n;i++) { x[i]*=2; } /*==================================*/ for(i=0;i<n;i++) { if(x[i]>=10) { x[i+1]+=x[i]/10; x[i]=x[i]%10; }//?? } } int max;//???????? for(max=n-1;max>0;max--) { if(x[max]!=0) break; } for (i=max;i>=0;i--) { cout<<x[i]; } return 0; }
25
12,084
int main() { int n;cin>>n; int answer1[40]={0}; answer1[0]=1; for(int i=0;i<n;i++) { for(int j=0;j<40;j++) //?????? { answer1[j]=answer1[j]*2; } for(int j=0;j<40;j++) { if(answer1[j]>=10) { answer1[j]=answer1[j]-10; answer1[j+1]++; } } } for(int i=37;i>=0;i--) { if(answer1[i]!=0||answer1[i+1]!=0||answer1[i+2]) cout<<answer1[i]; //???? } return 0; }
25
12,085
int n, num[100]; void multi() { int pos = 0, step; while(num[pos] == 0) { pos++; } for(int i = 99; i >= pos; i--) num[i] *= 2; for(int i = 99; i >= pos; i--) { if(num[i] >= 10) { step = num[i] / 10; num[i - 1] += step; num[i] = num[i] % 10; } } } int main() { int p = 0; cin >> n; if(n == 0) cout << 1 << endl; else { memset(num, 0, 100); num[99] = 2; for(int i = 1; i < n; i++) multi(); while(num[p] == 0) { p++; } for(; p < 100; p++) cout << num[p]; } return 0; }
25
12,086
int main() { int i, n, x, temp=0; int a[90]; memset(a, -1, sizeof(a)); a[89] = 2; cin >> n; if(n == 0) cout << "1"; else { while(--n) { temp = 0; for(i = 89; a[i] != -1; i--) { x = a[i] * 2 + temp; if(x < 10) { a[i] = x; temp = 0; } else { a[i] = x % 10; temp = x / 10; if(a[i - 1] == -1) { a[i-1] += temp + 1; break; } } } } for(i = 0; i < 90; i++) { if(a[i] != -1) cout << a[i]; } } return 0; }
25
12,087
int main(int argc, char* argv[]) { int n; double s=2; scanf("%d",&n); int i; if(n==0){ s=1; } if(n==1){ s=2; } if(n>=2){ for(i=2;i<=n;i++){ s=s*2; } } printf("%.0lf",s); return 0; }
25
12,088
int main() { int n,a[100] = {0},i,ii = 0,b[100] = {0}; cin >> n; //??n a[0] = 1; for (i = 0;i < n;i++) //??n? { for (ii = 0;ii < 100;ii++) b[ii] = 0; for (ii = 0;ii < 100;ii++) //????2 { a[ii] = a[ii] * 2; if (a[ii] >= 10) //?????? { b[ii + 1] = 1; a[ii]-= 10; } } for (ii = 0;ii < 100;ii++) //???? a[ii]+= b[ii]; } for (i = 99;a[i] == 0;i--); //?????????? while (i >= 0) //???? { cout << a[i]; i--; } return 0; }
25
12,089
int main () { int b[10000]={2}; int c=0,d=0,n=0; cin>>n; if(n==0) { cout<<"1"; } else { for (int i=1;i<n;i++) { for(int j=1;j<=10000;j++) { b[j-1]=b[j-1]+b[j-1]+c; if(b[j-1]>9) { c=1; b[j-1]=b[j-1]-10; } else { c=0; } } } for(int i=10000;i>0;i--) { if(b[i-1]!=0) { d=i; break; } } for(int i=d;i>0;i--) { cout<<b[i-1]; } } return 0; }
25
12,090
/* * ???? * Created on: 2013-1-4 * ?? * Author: ??? */ int main(){ double n; cin>>n; cout<<fixed<<setprecision(0)<<pow(2.0,n)<<endl; return 0; }
25
12,091
int main() { int a[200] = {0}, i, j, k, n, t; cin >> n; a[0] = 1; for (i = 1; i <= n; i++) { for (j = 0; j < 200; j++) a[j] *= 2; t = a[0] / 10; a[0] %= 10; for (j = 1; j < 200; j++) { a[j] = t + a[j]; t = a[j] / 10; a[j] %= 10; } } for (i = 199; i >= 0; i--) { if (a[i] != 0) { k = i; break; } } for (i = k; i >= 0; i--) cout << a[i]; cout << endl; return 0; }
25
12,092
int main() { int n; char a[200]; int len; int p = 0,q = 0; memset(a,0,sizeof(a)); a[0] = '2'; cin >> n; if (n == 0) cout << "1" << endl; else { for (int i = 1; i < n; i++) { len = strlen(a); for (int j = 0; j < len; j++) { p = a[j] - '0'; a[j] = (char) ((p * 2) % 10 + '0' + q); q = (p * 2) / 10; } if (q > 0) a[len] = (char) (q + '0'); p = 0; q = 0; } len = strlen(a); for (int i = len - 1; i >= 0; i--) cout << a[i]; } return 0; }
25
12,093
int main(int argc, char *argv[]) { int i,j,k=1,n; int b[100]={0}; scanf("%d",&n); b[99]=1; for(i=0;i<n;i++) { for(j=99;j>=0;j--) b[j]=b[j]*2; for(j=99;j>=0;j--) { if(b[j]>9) {b[j]=b[j]-10; b[j-1]++;} } } for(i=0;i<100;i++) { if(b[i]>0) break; } for(j=i;j<100;j++) printf("%d",b[j]); return 0; }
25
12,094
int a[50] = {0}; int length() { int i; for (i = 49; i >= 0; i--) if (a[i] != 0) return (i + 1); return 0; } void power(int N) { int i, temp, add = 0; if (N == -1) cout << "1" << endl; else if (N == 0) { for (i = length() - 1; i >= 0; i--) cout << a[i]; cout << endl; return; } else { for (i = 0; i < length(); i++) { temp = add + a[i] * 2; a[i] = temp % 10; add = temp / 10; } a[i] = add; power(N - 1); } } int main() { int N; a[0] = 2; cin >> N; power(N - 1); return 0; }
25
12,095
//************************************************* //***?????2?N??*** //***??????*** //***???2013.1.13*** //************************************************* int a[100]; void f() { int i,t = 0; for (i = 0; i < 100; i++) { a[i] = a[i] * 2 + t; t = a[i] / 10; a[i] = a[i] % 10; } } int main () { int N,i,j; memset(a,0,sizeof(a)); a[0] = 1; cin >> N; for (i = 0; i < N; i++) { f(); } i = 99; while (a[i] == 0) i--; for (j = i; j >= 0; j--) cout << a[j]; cout << endl; return 0; }
25
12,096
char a[100]; int n, i, j, k, times = 0; int ex[100] = {0}; int main() { cin >> n; if (n == 0) { cout << '1'; return 0; } for (i = 0; i != 100; i++) { if (i == 0) a[i] = '1'; else a[i] = '0'; } //???a???1 for (i = 1; i != n + 1; i++) { for (j = 0; j != i; j++) { if (a[j] <= '4') a[j] = (a[j] - '0') * 2 + '0'; else { a[j] = (a[j] - '0') * 2 + '0' - 10; ex[j + 1] = 1; } } for (k = 0; k != n; k++) { if (ex[k] == 1) { a[k]++; ex[k] = 0; } } } for (i = n - 1; i != -1; i--) { if (a[i] == '0' && times == 0) continue; else { cout << a[i]; times++; } } cout << endl; return 0; }
25
12,097
int main() { int n; cin>>n; cout<<endl; int num[1001]; for (int i=0;i<1001;i++) num[i]=0; num[0]=1;//???????1 for (int i=0;i<n;i++) {//??n?????? for (int j=0;j<1000;j++) {//????????? num[j]=num[j]+num[j]; } for (int j=0;j<1000;j++) {//??????????10?????? if (num[j]>=10) { num[j+1]=num[j+1]+1; num[j]=num[j]-10; } } } int k=1000; while (num[k]==0) k--;//???????0??? for (int i=k;i>=0;i--)//?????? cout<<num[i]; cout<<endl; return 0; }
25
12,098
int main(){ int n,i,e,d,k=1; int sz[100]={0},sum[100]={0}; sz[0]=2; scanf("%d",&n); int c=0; for(i=0;i<n-1;i++){ for(d=0;d<100;d++){ sum[d]=sz[d]+sz[d]+c; if(sum[d]>=10){ sum[d]-=10; c=1; }else{ c=0; } } for(e=0;e<100;e++){ sz[e]=sum[e]; } } int f=99; while(sz[f]==0){ f--; } if(n!=0){ for(i=f;i>=0;i--){ printf("%d",sz[i]); } }else{ printf("1"); } printf("\n"); return 0; }
25
12,099
int main() { char a[101]; memset(a, 0 , sizeof(a)); int i, j, n, flag = 0; cin >> n; a[100] = 1; for(i = 0 ; i < n ; i++) { j = 100; do { a[j] = 2 * a[j]; j--; }while(!(a[j] == 0 && a[j - 1] == 0 && a[j - 2] == 0 )); j = 100; do { if(a[j] >= 10) { a[j] = (int)a[j] % 10; a[j - 1] += 1; } j--; }while(!(a[j] == 0 && a[j - 1] == 0 && a[j - 2] == 0 )); } for(i = 0 ; i <= 100 ; i++) { if(a[i] == 0 && flag == 0) { continue; } else { flag = 1; cout << (int)a[i]; } } return 0; }
25