Pagini recente » Cod sursa (job #1738216) | Cod sursa (job #2225064) | Cod sursa (job #1772080) | Cod sursa (job #2472871) | Cod sursa (job #1799176)
#include <iostream>
#include <fstream>
#define nmax 256
#define modulo 194767
using namespace std;
int n,dp[nmax+1][nmax*nmax];
long long Starget,Smax,s;
int main()
{
ifstream fin ("1-sir.in");
ofstream fout("1-sir.out");
fin>>n>>Starget;
Smax=n*(n-1)/2;
s=Smax-Starget;
if(Starget<0)
Starget*=-1;
if(Starget>Smax)
{
fout<<0;
return 0;
}
for(int i=1;i<=n;i++)
dp[i][0]=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=s;j++)
{
dp[i][j]=dp[i-1][j];
if(dp[i][j-2*i]||dp[i-1][j-2*i])
dp[i][j]=(dp[i][j]+1)%194767;
}
}
fout<<dp[n][s];
return 0;
}