結果
問題 | No.1186 長方形の敷き詰め |
ユーザー | aqua_tenhou |
提出日時 | 2020-09-16 21:46:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 374 ms |
コンパイル使用メモリ | 87,056 KB |
実行使用メモリ | 71,652 KB |
最終ジャッジ日時 | 2023-09-04 03:59:35 |
合計ジャッジ時間 | 5,816 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
71,460 KB |
testcase_01 | AC | 70 ms
71,460 KB |
testcase_02 | AC | 71 ms
71,324 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 72 ms
71,456 KB |
testcase_06 | AC | 71 ms
71,332 KB |
testcase_07 | AC | 71 ms
71,456 KB |
testcase_08 | WA | - |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
def factorial_mod(n,mod): ret = 1 for i in range(1,n+1): ret *= i ret %= mod return ret def comb_mod(n,r,mod): if r > n or r < 0: ret = 0 else: fact_n = factorial_mod(n, mod) fact_r = factorial_mod(r, mod) fact_nr = factorial_mod(n-r, mod) ret = fact_n * pow(fact_r, mod-2, mod) * pow(fact_nr, mod-2, mod) % mod return ret n,m = map(int,input().split()) mod = 998244353 ans = 1 if m >= n: for i in range(1,m//n+1): k = m - n * i if i > k+1: ans += 1 else: ans += comb_mod(k+1,i,mod) ans %= mod print(ans)