ac-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub habara-k/ac-library

:heavy_check_mark: test/combination.test.cpp

Depends on

Code

#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5/DPL_5_B"

#include <atcoder/combination>
#include <atcoder/modint>
#include <iostream>

using namespace atcoder;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    if (n > k) {
        cout << 0 << endl;
        return 0;
    }

    using Int = modint1000000007;
    Combination<Int> comb(k);

    cout << (comb.C(k, n) * comb.fact(n)).val() << endl;
}
#line 1 "test/combination.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/7/DPL/5/DPL_5_B"

#include <atcoder/combination>
#include <atcoder/modint>
#include <iostream>

using namespace atcoder;
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;

    if (n > k) {
        cout << 0 << endl;
        return 0;
    }

    using Int = modint1000000007;
    Combination<Int> comb(k);

    cout << (comb.C(k, n) * comb.fact(n)).val() << endl;
}
Back to top page