# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20102 |
2016-02-25T13:34:25 Z |
imsifile |
순열 (kriii4_T) |
C++ |
|
381 ms |
1084 KB |
#include<stdio.h>
#define mod 1000000007
#define inv(a) exp(a,mod-2)
typedef long long lld;
lld exp(lld a, lld b){
if(b==0)return 1;
lld k=exp(a, b/2);
k=(k*k)%mod;
if(b%2)k=(k*a)%mod;
return k;
}
lld n, k, sum;
int main(){
lld i, fac=1;
scanf("%lld%lld", &n, &k);
for(i=1; i<=n+1; i++)fac=(fac*i)%mod;
for(i=k+1; i<=n; i++){
lld im = fac*(n-i+1)%mod * inv(i+1);
sum += im, sum%=mod;
}
printf("%lld", sum);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
0 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
0 ms |
1084 KB |
Output is correct |
12 |
Correct |
0 ms |
1084 KB |
Output is correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
0 ms |
1084 KB |
Output is correct |
16 |
Correct |
0 ms |
1084 KB |
Output is correct |
17 |
Correct |
0 ms |
1084 KB |
Output is correct |
18 |
Correct |
0 ms |
1084 KB |
Output is correct |
19 |
Correct |
0 ms |
1084 KB |
Output is correct |
20 |
Correct |
0 ms |
1084 KB |
Output is correct |
21 |
Correct |
0 ms |
1084 KB |
Output is correct |
22 |
Correct |
0 ms |
1084 KB |
Output is correct |
23 |
Correct |
0 ms |
1084 KB |
Output is correct |
24 |
Correct |
0 ms |
1084 KB |
Output is correct |
25 |
Correct |
0 ms |
1084 KB |
Output is correct |
26 |
Correct |
0 ms |
1084 KB |
Output is correct |
27 |
Correct |
0 ms |
1084 KB |
Output is correct |
28 |
Correct |
0 ms |
1084 KB |
Output is correct |
29 |
Correct |
0 ms |
1084 KB |
Output is correct |
30 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
340 ms |
1084 KB |
Output is correct |
2 |
Correct |
115 ms |
1084 KB |
Output is correct |
3 |
Correct |
47 ms |
1084 KB |
Output is correct |
4 |
Correct |
27 ms |
1084 KB |
Output is correct |
5 |
Correct |
45 ms |
1084 KB |
Output is correct |
6 |
Correct |
34 ms |
1084 KB |
Output is correct |
7 |
Correct |
273 ms |
1084 KB |
Output is correct |
8 |
Correct |
163 ms |
1084 KB |
Output is correct |
9 |
Correct |
56 ms |
1084 KB |
Output is correct |
10 |
Correct |
9 ms |
1084 KB |
Output is correct |
11 |
Correct |
114 ms |
1084 KB |
Output is correct |
12 |
Correct |
6 ms |
1084 KB |
Output is correct |
13 |
Correct |
55 ms |
1084 KB |
Output is correct |
14 |
Correct |
237 ms |
1084 KB |
Output is correct |
15 |
Correct |
138 ms |
1084 KB |
Output is correct |
16 |
Correct |
216 ms |
1084 KB |
Output is correct |
17 |
Correct |
103 ms |
1084 KB |
Output is correct |
18 |
Correct |
96 ms |
1084 KB |
Output is correct |
19 |
Correct |
22 ms |
1084 KB |
Output is correct |
20 |
Correct |
125 ms |
1084 KB |
Output is correct |
21 |
Correct |
80 ms |
1084 KB |
Output is correct |
22 |
Correct |
205 ms |
1084 KB |
Output is correct |
23 |
Correct |
78 ms |
1084 KB |
Output is correct |
24 |
Correct |
40 ms |
1084 KB |
Output is correct |
25 |
Correct |
45 ms |
1084 KB |
Output is correct |
26 |
Correct |
142 ms |
1084 KB |
Output is correct |
27 |
Correct |
15 ms |
1084 KB |
Output is correct |
28 |
Correct |
9 ms |
1084 KB |
Output is correct |
29 |
Correct |
381 ms |
1084 KB |
Output is correct |
30 |
Correct |
381 ms |
1084 KB |
Output is correct |