Submission #19001

# Submission time Handle Problem Language Result Execution time Memory
19001 2016-02-17T02:53:18 Z kriii 순열 (kriii4_T) C++14
100 / 100
46 ms 8896 KB
#include <stdio.h>

const long long mod = 1000000007;

long long inv[1000001];

int main()
{
	long long n,k,f=1,a=0; scanf ("%lld %lld",&n,&k);
	inv[1] = 1;
	for (long long l=1;l<=n;l++){
		inv[l+1] = (mod - mod / (l + 1)) * inv[mod % (l + 1)] % mod;
		if (l > k) a = (a + inv[l + 1] * (n - l + 1)) % mod;
		f = f * (l + 1) % mod;
	}
	printf ("%lld\n",a*f%mod);

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 8896 KB Output is correct
2 Correct 0 ms 8896 KB Output is correct
3 Correct 0 ms 8896 KB Output is correct
4 Correct 0 ms 8896 KB Output is correct
5 Correct 0 ms 8896 KB Output is correct
6 Correct 0 ms 8896 KB Output is correct
7 Correct 0 ms 8896 KB Output is correct
8 Correct 0 ms 8896 KB Output is correct
9 Correct 0 ms 8896 KB Output is correct
10 Correct 0 ms 8896 KB Output is correct
11 Correct 0 ms 8896 KB Output is correct
12 Correct 0 ms 8896 KB Output is correct
13 Correct 0 ms 8896 KB Output is correct
14 Correct 0 ms 8896 KB Output is correct
15 Correct 0 ms 8896 KB Output is correct
16 Correct 0 ms 8896 KB Output is correct
17 Correct 0 ms 8896 KB Output is correct
18 Correct 0 ms 8896 KB Output is correct
19 Correct 0 ms 8896 KB Output is correct
20 Correct 0 ms 8896 KB Output is correct
21 Correct 0 ms 8896 KB Output is correct
22 Correct 0 ms 8896 KB Output is correct
23 Correct 0 ms 8896 KB Output is correct
24 Correct 0 ms 8896 KB Output is correct
25 Correct 0 ms 8896 KB Output is correct
26 Correct 0 ms 8896 KB Output is correct
27 Correct 0 ms 8896 KB Output is correct
28 Correct 0 ms 8896 KB Output is correct
29 Correct 0 ms 8896 KB Output is correct
30 Correct 0 ms 8896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 8896 KB Output is correct
2 Correct 36 ms 8896 KB Output is correct
3 Correct 34 ms 8896 KB Output is correct
4 Correct 9 ms 8896 KB Output is correct
5 Correct 9 ms 8896 KB Output is correct
6 Correct 32 ms 8896 KB Output is correct
7 Correct 37 ms 8896 KB Output is correct
8 Correct 23 ms 8896 KB Output is correct
9 Correct 11 ms 8896 KB Output is correct
10 Correct 5 ms 8896 KB Output is correct
11 Correct 10 ms 8896 KB Output is correct
12 Correct 25 ms 8896 KB Output is correct
13 Correct 33 ms 8896 KB Output is correct
14 Correct 41 ms 8896 KB Output is correct
15 Correct 25 ms 8896 KB Output is correct
16 Correct 28 ms 8896 KB Output is correct
17 Correct 28 ms 8896 KB Output is correct
18 Correct 17 ms 8896 KB Output is correct
19 Correct 14 ms 8896 KB Output is correct
20 Correct 34 ms 8896 KB Output is correct
21 Correct 8 ms 8896 KB Output is correct
22 Correct 32 ms 8896 KB Output is correct
23 Correct 28 ms 8896 KB Output is correct
24 Correct 0 ms 8896 KB Output is correct
25 Correct 28 ms 8896 KB Output is correct
26 Correct 24 ms 8896 KB Output is correct
27 Correct 10 ms 8896 KB Output is correct
28 Correct 39 ms 8896 KB Output is correct
29 Correct 46 ms 8896 KB Output is correct
30 Correct 45 ms 8896 KB Output is correct