# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
19990 |
2016-02-25T08:11:33 Z |
ainta |
순열 (kriii4_T) |
C++ |
|
891 ms |
16864 KB |
#include<stdio.h>
#include<algorithm>
using namespace std;
int n, K;
long long F[1010000], InvF[1010000], Mod = 1000000007, Res;
long long Pow(long long a, int b){
long long r = 1;
while(b){
if(b&1)r=r*a%Mod;
a=a*a%Mod;b>>=1;
}
return r;
}
int main(){
int L, i;
scanf("%d%d",&n,&K);
F[0]=InvF[0]=1;
for(i=1;i<=n+1;i++){
F[i]=F[i-1]*i%Mod;
InvF[i] = Pow(F[i],Mod-2);
}
for(L=K+1;L<=n;L++){
Res = (Res + F[L]*F[n-L+1]%Mod*F[n+1]%Mod*InvF[L+1]%Mod*InvF[n-L])%Mod;
}
printf("%lld\n",Res);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
16864 KB |
Output is correct |
2 |
Correct |
0 ms |
16864 KB |
Output is correct |
3 |
Correct |
0 ms |
16864 KB |
Output is correct |
4 |
Correct |
0 ms |
16864 KB |
Output is correct |
5 |
Correct |
0 ms |
16864 KB |
Output is correct |
6 |
Correct |
0 ms |
16864 KB |
Output is correct |
7 |
Correct |
0 ms |
16864 KB |
Output is correct |
8 |
Correct |
0 ms |
16864 KB |
Output is correct |
9 |
Correct |
0 ms |
16864 KB |
Output is correct |
10 |
Correct |
0 ms |
16864 KB |
Output is correct |
11 |
Correct |
0 ms |
16864 KB |
Output is correct |
12 |
Correct |
0 ms |
16864 KB |
Output is correct |
13 |
Correct |
0 ms |
16864 KB |
Output is correct |
14 |
Correct |
0 ms |
16864 KB |
Output is correct |
15 |
Correct |
0 ms |
16864 KB |
Output is correct |
16 |
Correct |
0 ms |
16864 KB |
Output is correct |
17 |
Correct |
0 ms |
16864 KB |
Output is correct |
18 |
Correct |
0 ms |
16864 KB |
Output is correct |
19 |
Correct |
1 ms |
16864 KB |
Output is correct |
20 |
Correct |
0 ms |
16864 KB |
Output is correct |
21 |
Correct |
0 ms |
16864 KB |
Output is correct |
22 |
Correct |
0 ms |
16864 KB |
Output is correct |
23 |
Correct |
0 ms |
16864 KB |
Output is correct |
24 |
Correct |
0 ms |
16864 KB |
Output is correct |
25 |
Correct |
0 ms |
16864 KB |
Output is correct |
26 |
Correct |
0 ms |
16864 KB |
Output is correct |
27 |
Correct |
0 ms |
16864 KB |
Output is correct |
28 |
Correct |
0 ms |
16864 KB |
Output is correct |
29 |
Correct |
0 ms |
16864 KB |
Output is correct |
30 |
Correct |
0 ms |
16864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
885 ms |
16864 KB |
Output is correct |
2 |
Correct |
703 ms |
16864 KB |
Output is correct |
3 |
Correct |
697 ms |
16864 KB |
Output is correct |
4 |
Correct |
160 ms |
16864 KB |
Output is correct |
5 |
Correct |
162 ms |
16864 KB |
Output is correct |
6 |
Correct |
696 ms |
16864 KB |
Output is correct |
7 |
Correct |
808 ms |
16864 KB |
Output is correct |
8 |
Correct |
455 ms |
16864 KB |
Output is correct |
9 |
Correct |
206 ms |
16864 KB |
Output is correct |
10 |
Correct |
80 ms |
16864 KB |
Output is correct |
11 |
Correct |
272 ms |
16864 KB |
Output is correct |
12 |
Correct |
523 ms |
16864 KB |
Output is correct |
13 |
Correct |
674 ms |
16864 KB |
Output is correct |
14 |
Correct |
856 ms |
16864 KB |
Output is correct |
15 |
Correct |
492 ms |
16864 KB |
Output is correct |
16 |
Correct |
527 ms |
16864 KB |
Output is correct |
17 |
Correct |
547 ms |
16864 KB |
Output is correct |
18 |
Correct |
324 ms |
16864 KB |
Output is correct |
19 |
Correct |
290 ms |
16864 KB |
Output is correct |
20 |
Correct |
660 ms |
16864 KB |
Output is correct |
21 |
Correct |
230 ms |
16864 KB |
Output is correct |
22 |
Correct |
706 ms |
16864 KB |
Output is correct |
23 |
Correct |
572 ms |
16864 KB |
Output is correct |
24 |
Correct |
145 ms |
16864 KB |
Output is correct |
25 |
Correct |
721 ms |
16864 KB |
Output is correct |
26 |
Correct |
477 ms |
16864 KB |
Output is correct |
27 |
Correct |
207 ms |
16864 KB |
Output is correct |
28 |
Correct |
819 ms |
16864 KB |
Output is correct |
29 |
Correct |
890 ms |
16864 KB |
Output is correct |
30 |
Correct |
891 ms |
16864 KB |
Output is correct |