标签:des style blog http color os strong io
Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<string.h> 3 using namespace std; 4 int ans[1000][510]; 5 int main() 6 { 7 //memset(ans,0,sizeof(ans)); 8 int n,i,j; 9 while(scanf("%d",&n)!=EOF) 10 { 11 12 //i=300; 13 memset(ans,0,sizeof(ans)); 14 ans[500]=1; 15 while(n--) 16 { 17 int c=0; 18 int s=0; 19 20 for(i=500;i>=0;i--) 21 { 22 if(i==500) 23 s=ans[i]*2+1+c; 24 else s=ans[i]*2+c; 25 ans[i]=s%10; 26 c=s/10; 27 28 } 29 } 30 for(i=0;i<=500;i++) if(ans[i]!=0) break; 31 j=i; 32 for(j=i;j<=500;j++) printf("%d",ans[j]); 33 printf("\n"); 34 } 35 return 0; 36 }
D - Half of and a Half 大数,布布扣,bubuko.com
标签:des style blog http color os strong io
原文地址:http://www.cnblogs.com/angledamon/p/3888186.html