poj2229 动态规划Sumsets
考虑最后有没1.#include <cstdio>#include <iostream>#include <cstring>using namespace std;long long d[1000010];int main() {int N;cin >> N;memset(d, 0, size...
·
考虑最后有没1.
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
long long d[1000010];
int main() {
int N;
cin >> N;
memset(d, 0, sizeof(d));
d[0] = 1;
for (int i = 1; i <= N; ++i) {
if ((i & 1) == 1) {
d[i] = d[i - 1];
}
else {
d[i] = (d[i - 1] + d[i / 2]) % 1000000000;
}
}
cout << d[N] << endl;
}
更多推荐
已为社区贡献1条内容
所有评论(0)