Pagini recente » Cod sursa (job #333964) | Cod sursa (job #1129899) | Atasamentele paginii Clasament pre-oji | Cod sursa (job #1625939) | Cod sursa (job #1120875)
#include <fstream>
#include <cstring>
#include <cmath>
using namespace std;
ifstream fin ("1-sir.in");
ofstream fout ("1-sir.out");
const int NMAX = 260;
const int MOD = 194767;
int N; int S; int D[2][NMAX * NMAX];
int abs(int x){ return x > 0 ? x : -x;}
int main() {
fin >> N >> S;
if(S > N * (N - 1) / 2) {
fout << 0;
return 0;
}
int act = 0;
D[0][0] = 1;
for(int i = 2; i <= N; ++i) {
act = !act;
for(int j = 0; j <= N * (N - 1) / 2; ++j)
D[act][j] = (D[!act][j + i - 1] + D[!act][abs(j - i + 1)]) % MOD;
}
fout << D[act][S] << '\n';
return 0;
}