結果

問題 No.1186 長方形の敷き詰め
ユーザー anagohirameanagohirame
提出日時 2020-08-22 13:38:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 91,356 KB
最終ジャッジ日時 2024-04-23 08:04:11
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
74,692 KB
testcase_01 AC 59 ms
75,512 KB
testcase_02 AC 59 ms
74,648 KB
testcase_03 AC 62 ms
75,804 KB
testcase_04 AC 61 ms
74,688 KB
testcase_05 AC 61 ms
75,916 KB
testcase_06 AC 60 ms
74,184 KB
testcase_07 AC 58 ms
75,188 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 65 ms
74,440 KB
testcase_12 AC 68 ms
74,648 KB
testcase_13 AC 65 ms
75,132 KB
testcase_14 AC 65 ms
74,252 KB
testcase_15 AC 61 ms
74,668 KB
testcase_16 AC 69 ms
74,148 KB
testcase_17 AC 64 ms
74,524 KB
testcase_18 AC 62 ms
75,064 KB
testcase_19 AC 64 ms
74,860 KB
testcase_20 AC 68 ms
75,040 KB
testcase_21 AC 65 ms
74,292 KB
testcase_22 AC 115 ms
91,024 KB
testcase_23 AC 61 ms
75,308 KB
testcase_24 AC 62 ms
74,512 KB
testcase_25 AC 65 ms
74,692 KB
testcase_26 AC 61 ms
76,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
list_size = 1000001

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

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

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

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

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

n, m = map(int, input().split())
ans = 0
for i in range(m//n+1):
	ans += comb(m-n*i+i, i)
	ans %= MOD
print(ans)
0