#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9+7;
const int N = 4e5+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;
int q;
while(cin >> q);
cout << ncr(n+r-1, r) << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
32 ms |
6736 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
3416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
27 ms |
6744 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
49 ms |
8528 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
32 ms |
6736 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |