Cod sursa(job #2900253)
| Utilizator | Data | 10 mai 2022 17:05:50 | |
|---|---|---|---|
| Problema | Sandokan | Scor | 15 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.56 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("sandokan.in");
ofstream fout("sandokan.out");
int n,k;
const int modulo = 2000003;
int c[10000];
int a[10000];
int main()
{
fin>>n>>k;
while(n>=k)
{
++n-=k;
}
c[0]=1;
a[0]=1;
a[1]=1;
for(int i=2;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
c[j]= a[j]+a[j-1];
if(c[j]>modulo)
c[j]%=modulo;
}
memcpy(a,c,sizeof(c));
}
fout<<a[n-1];
}
