标签:
| Time Limit: 2000MS | Memory Limit: 200000K | |
| Total Submissions: 13210 | Accepted: 5300 |
Description
Input
Output
Sample Input
7
Sample Output
6
Source
。參考了大牛的解题报告:Click
#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;
}版权声明:本文博主原创文章。博客,未经同意不得转载。
标签:
原文地址:http://www.cnblogs.com/hrhguanli/p/4828424.html