結果

問題 No.1044 正直者大学
ユーザー anagohirameanagohirame
提出日時 2020-05-01 22:30:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 655 ms / 2,000 ms
コード長 692 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 23,808 KB
最終ジャッジ日時 2023-08-26 15:10:24
合計ジャッジ時間 9,296 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 213 ms
23,588 KB
testcase_01 AC 215 ms
23,688 KB
testcase_02 AC 227 ms
23,676 KB
testcase_03 AC 213 ms
23,684 KB
testcase_04 AC 219 ms
23,672 KB
testcase_05 AC 211 ms
23,624 KB
testcase_06 AC 655 ms
23,640 KB
testcase_07 AC 212 ms
23,640 KB
testcase_08 AC 217 ms
23,676 KB
testcase_09 AC 228 ms
23,624 KB
testcase_10 AC 215 ms
23,640 KB
testcase_11 AC 227 ms
23,808 KB
testcase_12 AC 248 ms
23,624 KB
testcase_13 AC 473 ms
23,780 KB
testcase_14 AC 222 ms
23,632 KB
testcase_15 AC 245 ms
23,680 KB
testcase_16 AC 444 ms
23,632 KB
testcase_17 AC 294 ms
23,664 KB
testcase_18 AC 369 ms
23,628 KB
testcase_19 AC 237 ms
23,588 KB
testcase_20 AC 216 ms
23,632 KB
testcase_21 AC 241 ms
23,676 KB
testcase_22 AC 216 ms
23,652 KB
testcase_23 AC 216 ms
23,648 KB
testcase_24 AC 214 ms
23,652 KB
testcase_25 AC 224 ms
23,660 KB
testcase_26 AC 225 ms
23,628 KB
testcase_27 AC 209 ms
23,780 KB
testcase_28 AC 216 ms
23,676 KB
testcase_29 AC 209 ms
23,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9 + 7
list_size = 200001

f_list = [1] * list_size
f_r_list = [1] * list_size

for i in range(list_size - 1):
	f_list[i + 1] = int((f_list[i] * (i + 2)) % MOD)

f_r_list[-1] = pow(f_list[-1], MOD - 2, MOD)

for i in range(2, list_size + 1):
	f_r_list[-i] = int((f_r_list[-i + 1] * (list_size + 2 - i)) % MOD)

def comb(n, r):
	if n < r:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return (((f_list[n - 1] * f_r_list[n - r - 1]) % MOD) * f_r_list[r - 1]) % MOD 

n, m, k = map(int, input().split())
ans = 0
for i in range(1, min(n, m, (n+m-k)//2)+1):
	ans += f_list[n-1] * comb(n-1, i-1) * f_list[m-1] * comb(m-1, i-1) * pow(i, MOD-2, MOD)
	ans %= MOD
print(ans)
0