mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
31 lines
448 B
C++
31 lines
448 B
C++
|
#include <iostream>
|
||
|
#include <cstring>
|
||
|
#include <cstdlib>
|
||
|
using namespace std;
|
||
|
|
||
|
const int M = 120 + 10;
|
||
|
|
||
|
int dp[M];
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int n;
|
||
|
while (~scanf("%d", &n))
|
||
|
{
|
||
|
|
||
|
memset(dp, 0, sizeof(dp));
|
||
|
dp[0] = 1;
|
||
|
|
||
|
for (int i = 1; i <= n; i++)
|
||
|
{
|
||
|
for (int j = i; j <= n; j++)
|
||
|
{
|
||
|
dp[j] += dp[j - i];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
printf("%d\n", dp[n]);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|