Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <string>
- #include <algorithm>
- #include <fstream>
- #include <set>
- #include <iomanip>
- #include <iso646.h>
- #include <stdio.h>
- #include <map>
- #define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- #define ss second
- #define ff first
- #define ll long long
- #define mp make_pair
- #define endl "\n"
- #define pb push_back
- #define ld long double
- #define M_PI 3.14159265358979323846 /* pi */
- const double EPS = 0.0000000001;
- using namespace std;
- const ll INF = 1000000007;
- ll binpow(ll a, ll n) {
- ll res = 1;
- while (n) {
- if (n & 1)
- {
- res *= a;
- res %= INF;
- n--;
- }
- else
- {
- a *= a;
- a %= INF;
- n /= 2;
- }
- }
- return res;
- }
- ll C(ll n, ll k) {
- ll res = 1;
- for (int i = 1; i <= k; ++i)
- res = (res * (n - k + i) % INF*binpow(i, INF - 2))%INF;
- return res;
- }
- int main()
- {
- sync;
- ll n, k;
- cin >> n >> k;
- cout << C(n - 1, n - k)%INF;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement