Pagini recente » Cod sursa (job #2225721) | Cod sursa (job #2225727) | Cod sursa (job #648259) | Istoria paginii runda/simulare-cartita-21/clasament | Cod sursa (job #1318188)
#include <cstdio>
#include <cstdlib>
#define supermax 32640
#define SMax 40000
#define MOD 194768
using namespace std;
int N,S,Smax;
int DP[SMax];
void Read()
{
scanf("%d%d",&N,&S);
if(S < 0)
S *= -1;
if(S > supermax){
printf("0\n");
exit(0);
}
Smax = N * (N - 1) / 2;
S = Smax - S;
}
void Solve()
{
int w;
DP[0] = 1;
for(int i = 1; i < N; ++i)
{
w = 2*i;
for(int j = (i+1)*i; j >= w; --j)
DP[j] += DP[j-w];
}
printf("%d\n",DP[S]);
}
int main()
{
freopen("1-sir.in","r",stdin);
freopen("1-sir.out","w",stdout);
Read();
Solve();
return 0;
}