Mai intai trebuie sa te autentifici.
Cod sursa(job #2837993)
| Utilizator | Data | 22 ianuarie 2022 22:55:29 | |
|---|---|---|---|
| Problema | Sandokan | Scor | 25 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
#define MOD 2000003
using namespace std;
long long n,k,p,c[5002][5002];
ifstream fin("sandokan.in");
ofstream fout("sandokan.out");
int main()
{
fin >> n >> k;
p = (n-1)%(k-1)+1;
c[0][0] = 1;
for(int i = 1; i <= n; i++){
for(int j = 0; j <= i; j++){
c[i][j] = (c[i-1][j]+c[i-1][j-1])%MOD;
}
}
fout << c[n-1][p-1] << "\n";
return 0;
}
