29 lines
532 B
C
29 lines
532 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int sums(int x);
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
printf("%d\n", sums(100));
|
||
|
}
|
||
|
|
||
|
int sums(int x)
|
||
|
{
|
||
|
int i, n;
|
||
|
int s[x + 1][x];
|
||
|
|
||
|
for(n = 0; n <= x; ++n){
|
||
|
s[n][0] = 1;
|
||
|
for(i = 2; i < n; ++i){
|
||
|
s[n][i - 1] = s[n][i - 2];
|
||
|
if(n - i <= i){
|
||
|
s[n][i - 1] += s[n - i][n - i - 1];
|
||
|
}else{
|
||
|
s[n][i - 1] += s[n - i][i - 1];
|
||
|
}
|
||
|
}
|
||
|
s[n][i - 1] = s[n][i - 2] + 1;
|
||
|
}
|
||
|
return s[x][x - 1] - 1;
|
||
|
}
|