Pagini recente » algoritmiada-2019/runda-preoji/clasament | Cod sursa (job #2535667) | Cod sursa (job #2147628) | Cod sursa (job #3224406) | Cod sursa (job #1651732)
#include <iostream>
#include <fstream>
#include <algorithm>
#define MOD 194767
using namespace std;
ifstream in("1-sir.in");
ofstream out("1-sir.out");
int m[2][33000];
int main() {
int n,s;
in >> n >> s;
m[0][0] = 1;
for(int i = 2; i <= n; i++) {
for(int j = 0; j <= i*(i-1)/2; j++)
m[1][j] = (m[0][abs(j-(i-1))]+m[0][abs(j+(i-1))])%MOD;
for(int j = 0; j <= i*(i-1)/2; j++)
m[0][j] = m[1][j];
}
out << m[0][abs(s)];
return 0;
}