Submission #19919

# Submission time Handle Problem Language Result Execution time Memory
19919 2016-02-25T07:15:25 Z xdoju 괄호 (kriii4_R) C++14
8 / 100
125 ms 1084 KB
#include <cstdio>
using namespace std;

const int MOD = 1000000007ll;

int modpow(int r, int n) {
	int ret = 1;
	while (n > 0) {
		if (n % 2 > 0) {
			ret = ((long long)ret * r) % MOD;
		}
		r = ((long long)r * r) % MOD;
		n /= 2;
	}
	return ret;
}

inline int modinv(int n) {
	return modpow(n, MOD - 2);
}

inline int modprod(int a, int b) {
	a = a % MOD;
	b = b % MOD;
	return ((long long)a * b) % MOD;
}

inline int modprod(int a, int b, int c) {
	c = c % MOD;
	return (modprod(a, b) * (long long)c) % MOD;
}

inline int moddiv(int a, int b) {
	return ((long long)a * modinv(b)) % MOD;
}

int cc(int n) {
	int ret = 1;
	for (int k = 2 * n; k > n; --k) {
		ret = modprod(ret, k);
	}
	for (int k = 1; k <= n; ++k) {
		ret = moddiv(ret, k);
	}
	return ret;
}

void proc() {
	int n, k;
	scanf("%d %d", &n, &k);

	if (n % 2 == 0) {
		printf("%d", cc(n / 2));
	}
	else {
		printf("%d", moddiv(cc((n + 1) / 2), 2));
	}
}

int main() {
	proc();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1084 KB Output is correct
2 Correct 8 ms 1084 KB Output is correct
3 Correct 92 ms 1084 KB Output is correct
4 Correct 103 ms 1084 KB Output is correct
5 Correct 105 ms 1084 KB Output is correct
6 Correct 58 ms 1084 KB Output is correct
7 Correct 66 ms 1084 KB Output is correct
8 Correct 44 ms 1084 KB Output is correct
9 Correct 18 ms 1084 KB Output is correct
10 Correct 4 ms 1084 KB Output is correct
11 Correct 5 ms 1084 KB Output is correct
12 Correct 94 ms 1084 KB Output is correct
13 Correct 89 ms 1084 KB Output is correct
14 Correct 39 ms 1084 KB Output is correct
15 Correct 42 ms 1084 KB Output is correct
16 Correct 38 ms 1084 KB Output is correct
17 Correct 114 ms 1084 KB Output is correct
18 Correct 118 ms 1084 KB Output is correct
19 Correct 125 ms 1084 KB Output is correct
20 Correct 121 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -