#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;
const int N = 2e5+10;
long long fact[N];
long long binpow(long long a, long long b) {
long long ans = 1;
while(b) {
if(b&1) {
ans=(ans*a)%mod;
}
a=(a*a)%mod;
b>>=1;
}
return ans;
}
long long ncr(long long nn, long long rr) {
if(rr > nn)return 0;
long long ans = fact[nn];
ans = (ans*binpow(fact[rr], mod-2))%mod;
ans = (ans*binpow(fact[nn-rr], mod-2))%mod;
return ans;
}
int main () {
cin.tie(0)->sync_with_stdio(0);
fact[0] = 1;
for(int i = 1;i<N;i++)fact[i] = (fact[i-1]*i)%mod;
int n, r;
cin >> n >> r;
cout << ncr(n+r-1, r) << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3672 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3676 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3672 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |