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 |
奇怪 求why#include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> int f[1000010]={0}; int main() { int n,i,j,k,sign; while(scanf("%d",&n)!=EOF) { f[0]=0; f[1]=1; f[2]=2; for(i=3;i<=n;i++) { if(i%2) f[i]=f[i-1]; else f[i]=f[i/2]%1000000000+f[i-2]%1000000000;// 改成f[i]=(f[i/2]+f[i-2])/1000000000;就ac!。。 } printf("%d\n",f[n]); memset(f,0,sizeof(f)); } //system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator