Cod sursa(job #1511111)

Utilizator george.stefanGeorge Stefan george.stefan Data 26 octombrie 2015 01:47:03
Problema Kperm Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 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;

    for(int i = 2; i < n; i++)
    {
        if(i != k)
        {
            rez = (rez * (i % M)) % M;
        }
    }

    cout << rez;

    return 0;
}