Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
暴力水之!!!!!无语附代码#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> int a[123][3366]; int main() { int i,j,n,l,q,w,e,r,t; while(~scanf("%d%d%d",&q,&w,&e)) { memset(a,0,sizeof(a)); for(i=1;;i++) { if(q/pow(10.00,i)==0) { a[0][i-1]=q; break; } else { a[0][i-1]=q%10; q/=10; } } for(i=1;;i++) { if(e/pow(10.00,i)==0) { a[2][i-1]=e; break; } else { a[2][i-1]=e%10; e/=10; } } for(i=1;;i++) { if(w/pow(10.00,i)==0) { a[1][i-1]=w; break; } else { a[1][i-1]=w%10; w/=10; } } /* for(i=0;i<3;i++) { for(j=0;j<5;j++) printf("%d",a[i][j]); printf("\n"); } */ int e=0,m; for(i=3;i<=99;i++) { e=0; for(j=0;j<i+4;j++) { m=a[i-3][j]+a[i-2][j]+a[i-1][j]+e; if(m<10) { a[i][j]=m; e=0; } else { a[i][j]=m%10; e=m/10; } } } int o=0; for(i=56;i>=0;i--) { if(o==1) { printf("%d",a[99][i]); } if(a[99][i]!=0&&o==0){ o=1; printf("%d",a[99][i]);; } } printf("\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator