Submission #21420

# Submission time Handle Problem Language Result Execution time Memory
21420 2017-04-13T19:34:50 Z gs14004 순열 (kriii4_T) C++11
100 / 100
203 ms 2020 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
const int mod = 1e9 + 7;

lint ipow(lint x, lint p){
	lint ret = 1, piv = x % mod;
	while(p){
		if(p&1) ret *= piv;
		piv *= piv;
		ret %= mod;
		piv %= mod;
		p >>= 1;
	}
	return ret % mod;
}

int n, k;

int main(){
	cin >> n >> k;
	lint ans = 0;
	for(int i=k+1; i<=n; i++){
		ans += (n - i + 1) * ipow(i+1, mod - 2) % mod;
		ans %= mod;
	}
	for(int i=2; i<=n+1; i++) ans = (ans * i) % mod;
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 0 ms 2020 KB Output is correct
7 Correct 0 ms 2020 KB Output is correct
8 Correct 0 ms 2020 KB Output is correct
9 Correct 0 ms 2020 KB Output is correct
10 Correct 0 ms 2020 KB Output is correct
11 Correct 0 ms 2020 KB Output is correct
12 Correct 0 ms 2020 KB Output is correct
13 Correct 0 ms 2020 KB Output is correct
14 Correct 0 ms 2020 KB Output is correct
15 Correct 0 ms 2020 KB Output is correct
16 Correct 0 ms 2020 KB Output is correct
17 Correct 0 ms 2020 KB Output is correct
18 Correct 0 ms 2020 KB Output is correct
19 Correct 0 ms 2020 KB Output is correct
20 Correct 0 ms 2020 KB Output is correct
21 Correct 0 ms 2020 KB Output is correct
22 Correct 0 ms 2020 KB Output is correct
23 Correct 0 ms 2020 KB Output is correct
24 Correct 0 ms 2020 KB Output is correct
25 Correct 0 ms 2020 KB Output is correct
26 Correct 0 ms 2020 KB Output is correct
27 Correct 0 ms 2020 KB Output is correct
28 Correct 0 ms 2020 KB Output is correct
29 Correct 0 ms 2020 KB Output is correct
30 Correct 0 ms 2020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 203 ms 2020 KB Output is correct
2 Correct 66 ms 2020 KB Output is correct
3 Correct 26 ms 2020 KB Output is correct
4 Correct 16 ms 2020 KB Output is correct
5 Correct 23 ms 2020 KB Output is correct
6 Correct 19 ms 2020 KB Output is correct
7 Correct 149 ms 2020 KB Output is correct
8 Correct 86 ms 2020 KB Output is correct
9 Correct 29 ms 2020 KB Output is correct
10 Correct 3 ms 2020 KB Output is correct
11 Correct 59 ms 2020 KB Output is correct
12 Correct 6 ms 2020 KB Output is correct
13 Correct 29 ms 2020 KB Output is correct
14 Correct 149 ms 2020 KB Output is correct
15 Correct 103 ms 2020 KB Output is correct
16 Correct 116 ms 2020 KB Output is correct
17 Correct 56 ms 2020 KB Output is correct
18 Correct 73 ms 2020 KB Output is correct
19 Correct 9 ms 2020 KB Output is correct
20 Correct 79 ms 2020 KB Output is correct
21 Correct 46 ms 2020 KB Output is correct
22 Correct 109 ms 2020 KB Output is correct
23 Correct 59 ms 2020 KB Output is correct
24 Correct 19 ms 2020 KB Output is correct
25 Correct 23 ms 2020 KB Output is correct
26 Correct 76 ms 2020 KB Output is correct
27 Correct 6 ms 2020 KB Output is correct
28 Correct 6 ms 2020 KB Output is correct
29 Correct 203 ms 2020 KB Output is correct
30 Correct 203 ms 2020 KB Output is correct