Cod sursa(job #2303275)

Utilizator maria15Maria Dinca maria15 Data 15 decembrie 2018 22:34:24
Problema Sandokan Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <fstream>
#define mod 2000003

using namespace std;

ifstream fin("sandokan.in");
ofstream fout("sandokan.out");

int c[5001], x;
short n, k, i;
long long sol = 1;

int main(){
    fin>>n>>k;
    for(i=1;i<=n;i++)
        fin>>x;
    i = 1;
    c[0] = 1;
    while(i <= n){
        for(x=i;x>0;x--)
            c[x] = (c[x]+c[x-1])%mod;
        if((n-i)%(k-1) == 0 && k <= i)
            sol = (sol*c[k])%mod;
        i++;
    }

    fout<<sol;
    return 0;
}