Cod sursa(job #2711943)
Utilizator | Data | 24 februarie 2021 21:46:01 | |
---|---|---|---|
Problema | Sandokan | Scor | 85 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin ("sandokan.in");
ofstream fout ("sandokan.out");
int n, p, k, v[5001];
int main (){
fin>>n>>k;
p=n;
while(p > k)
p-=(k-1);
n--, p--;
v[0]=v[1]=1;
for(int i=2; i<=n; i++)
for(int j=i; j>=1; j--){
v[j] += v[j-1];
v[j] %= 2000003;
}
fout<<v[p];
return 0;
}