結果

問題 No.2023 Tiling is Fun
ユーザー とりゐとりゐ
提出日時 2022-08-08 15:01:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 1,296 ms
コンパイル使用メモリ 81,128 KB
実行使用メモリ 66,332 KB
最終ジャッジ日時 2023-10-19 04:47:06
合計ジャッジ時間 4,120 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
66,332 KB
testcase_01 AC 61 ms
66,332 KB
testcase_02 AC 63 ms
66,332 KB
testcase_03 AC 62 ms
66,332 KB
testcase_04 AC 62 ms
66,332 KB
testcase_05 AC 61 ms
66,332 KB
testcase_06 AC 62 ms
66,332 KB
testcase_07 AC 62 ms
66,332 KB
testcase_08 AC 62 ms
66,332 KB
testcase_09 AC 61 ms
66,332 KB
testcase_10 AC 61 ms
66,332 KB
testcase_11 AC 61 ms
66,332 KB
testcase_12 AC 61 ms
66,332 KB
testcase_13 AC 61 ms
66,332 KB
testcase_14 AC 61 ms
66,332 KB
testcase_15 AC 61 ms
66,332 KB
testcase_16 AC 60 ms
66,332 KB
testcase_17 AC 61 ms
66,332 KB
testcase_18 AC 62 ms
66,332 KB
testcase_19 AC 63 ms
66,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
M=(10**5)*3+1 
fac=[1]*M
ninv=[1]*M
finv=[1]*M
for i in range(2,M):
  fac[i]=fac[i-1]*i%mod
  ninv[i]=(-(mod//i)*ninv[mod%i])%mod
  finv[i]=finv[i-1]*ninv[i]%mod

def binom(n,k):
  if n<0 or k<0:
    return 0
  if k>n:
    return 0
  return (fac[n]*finv[k]%mod)*finv[n-k]%mod

a,b=map(lambda x:int(x)-1,input().split())
print(binom(a+b,a))
0