URAL1017. Staircases

时间:2023-03-09 10:02:08
URAL1017. Staircases

链接

简单递推

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
using namespace std;
#define LL long long
LL dp[][];
int main()
{
int i,j,n,g;
LL ans=;
scanf("%d",&n);
for(i = ; i <= n ;i++)
dp[i][i] = ;
for(i = ; i <= n ;i++)
{
for(j = ; j < i ; j++)
{
for(g = ; g < j ; g++)
dp[i][j]+=dp[i-j][g];
}
}
for(i = ; i < n ;i++)
ans+=dp[n][i];
printf("%lld\n",ans);
return ;
}