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 <iostream> #include <cstdio> #include <cstring> #define mod 1000000000 using namespace std; int d[1000005]; int main() { memset(d,0,sizeof(d)); d[1]=1; d[2]=2; int n; scanf("%d",&n); for(int i=3;i<=n;i++) { d[i]=d[i-1]; i++; d[i]=(d[i-1]%mod+d[i/2]%mod)%mod; } printf("%d\n",d[n]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator