Cod sursa(job #1511112)
| Utilizator | Data | 26 octombrie 2015 01:48:30 | |
|---|---|---|---|
| Problema | Kperm | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <stdio.h>
#define M 666013
using namespace std;
int main()
{
freopen("kperm.in","r",stdin);
freopen("kperm.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(0);
// (n-1)!/k
int n, k, rez = 1;
cin >> n >> k;
if(k == 2)
cout << 0;
else
{
for(int i = 2; i < n; i++)
{
if(i != k)
{
rez = (rez * (i % M)) % M;
}
}
cout << rez;
}
return 0;
}
