mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
1b4d6396e4
2700-2799
25 lines
475 B
C++
25 lines
475 B
C++
#include<iostream>
|
|
#include<algorithm>
|
|
#include<cstdio>
|
|
#include<cstring>
|
|
using namespace std;
|
|
long long dp[1000001];
|
|
int main()
|
|
{
|
|
int n,i,j;
|
|
while(scanf("%d",&n)!=EOF)
|
|
{
|
|
memset(dp,0,sizeof(dp)); dp[0]=1;
|
|
for(i=1;i<=n;i*=2)
|
|
{
|
|
for(j=i;j<=n;j++)
|
|
{
|
|
dp[j]+=dp[j-i];
|
|
dp[j]%=1000000000;
|
|
}
|
|
}
|
|
printf("%lld\n",dp[n]);
|
|
}
|
|
return 0;
|
|
}
|