标签:poj2229
Time Limit: 2000MS | Memory Limit: 200000K | |
Total Submissions: 13210 | Accepted: 5300 |
Description
Input
Output
Sample Input
7
Sample Output
6
Source
#include <stdio.h> #include <string.h> #define maxn 1000002 int dp[maxn]; int main() { int i, n; scanf("%d", &n); dp[1] = 1; for(i = 2; i <= n; ++i) { if(i & 1) dp[i] = dp[i-1]; else dp[i] = dp[i-1] + dp[i/2]; dp[i] %= 1000000000; } printf("%d\n", dp[n]); return 0; }
标签:poj2229
原文地址:http://blog.csdn.net/chang_mu/article/details/41173639