Submission #20086

# Submission time Handle Problem Language Result Execution time Memory
20086 2016-02-25T10:47:09 Z gs12117 순열 (kriii4_T) C++
100 / 100
1114 ms 1084 KB
#include<stdio.h>
int n,m;
int mod=1000000007;
int mpow(int x,int y){
	if(y==0)return 1;
	long long int r=mpow(x,y/2);
	r*=r;
	r%=mod;
	if(y%2==1){
		r*=x;
		r%=mod;
	}
	return r;
}
long long int minv(int x){
	return mpow(x,mod-2);
}
int main(){
	int i;
	long long int ans;
	scanf("%d%d",&n,&m);
	ans=0;
	for(i=m+2;i<=n+1;i++){
		ans+=minv(i)*(n+2-i);
		ans%=mod;
	}
	ans*=n+1;
	ans%=mod;
	for(i=1;i<=n;i++){
		ans*=i;
		ans%=mod;
	}
	printf("%lld",ans);
	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 1 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 1 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 988 ms 1084 KB Output is correct
2 Correct 333 ms 1084 KB Output is correct
3 Correct 137 ms 1084 KB Output is correct
4 Correct 89 ms 1084 KB Output is correct
5 Correct 132 ms 1084 KB Output is correct
6 Correct 99 ms 1084 KB Output is correct
7 Correct 796 ms 1084 KB Output is correct
8 Correct 477 ms 1084 KB Output is correct
9 Correct 163 ms 1084 KB Output is correct
10 Correct 26 ms 1084 KB Output is correct
11 Correct 330 ms 1084 KB Output is correct
12 Correct 25 ms 1084 KB Output is correct
13 Correct 160 ms 1084 KB Output is correct
14 Correct 689 ms 1084 KB Output is correct
15 Correct 400 ms 1084 KB Output is correct
16 Correct 628 ms 1084 KB Output is correct
17 Correct 298 ms 1084 KB Output is correct
18 Correct 279 ms 1084 KB Output is correct
19 Correct 64 ms 1084 KB Output is correct
20 Correct 362 ms 1084 KB Output is correct
21 Correct 233 ms 1084 KB Output is correct
22 Correct 597 ms 1084 KB Output is correct
23 Correct 228 ms 1084 KB Output is correct
24 Correct 116 ms 1084 KB Output is correct
25 Correct 130 ms 1084 KB Output is correct
26 Correct 415 ms 1084 KB Output is correct
27 Correct 42 ms 1084 KB Output is correct
28 Correct 26 ms 1084 KB Output is correct
29 Correct 1114 ms 1084 KB Output is correct
30 Correct 1110 ms 1084 KB Output is correct