Pagini recente » Cod sursa (job #1957233) | Cod sursa (job #2822174) | Cod sursa (job #3230919) | Cod sursa (job #2986141) | Cod sursa (job #3291020)
#include <fstream>
#include <cmath>
#include <cstring>
#define mod 194767
using namespace std;
ifstream cin("1-sir.in");
ofstream cout("1-sir.out");
int dp[2][32650],t,n,s;
signed main()
{
cin>>n>>s;
if(s<0)
s*=(-1);
if(s>n*(n-1)/2){
cout<<0;
return 0;
}
dp[1][0]=1;
for(int i=1;i<n;i++){
memset(dp[t],0,sizeof(dp[t]));
for(int j=0;j<=n*(n-1)/2;j++)
dp[t][j]=(dp[t][j]+dp[1-t][abs(j-i)]+dp[1-t][j+i])%mod;
t=1-t;
}
cout<<dp[1-t][s];
return 0;
}