Pagini recente » Cod sursa (job #2547502) | Cod sursa (job #2159187) | Cod sursa (job #278149) | Cod sursa (job #2517557) | Cod sursa (job #3148256)
#include <fstream>
using namespace std;
ifstream cin ("sandokan.in");
ofstream cout ("sandokan.out");
const int mod = 2e6 + 3;
int Invers (const int valoare)
{
return valoare <= 1 ? 1 : mod - 1LL * (mod / valoare) * Invers(mod % valoare) % mod;
}
int Combinari (const int lungime , const int luate)
{
int numarator = 1 , numitor = 1;
for (int valoare = 1 ; valoare <= luate ; valoare++) {
numarator = 1LL * numarator * (lungime - luate + valoare) % mod;
numitor = 1LL * numitor * valoare % mod;
}
return 1LL * numarator * Invers(numitor) % mod;
}
int main ()
{
int lungime , luate;
cin >> lungime >> luate;
cout << Combinari(--lungime , --luate);
cout.close(); cin.close();
return 0;
}