結果
| 問題 | No.3160 Party Game | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2025-06-18 03:52:48 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 596 bytes | 
| コンパイル時間 | 373 ms | 
| コンパイル使用メモリ | 82,080 KB | 
| 実行使用メモリ | 268,496 KB | 
| 最終ジャッジ日時 | 2025-06-18 03:53:08 | 
| 合計ジャッジ時間 | 19,659 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 36 WA * 2 | 
ソースコード
import sys
input = sys.stdin.readline
mod=998244353
FACT=[1]
for i in range(1,5*10**6+1):
    FACT.append(FACT[-1]*i%mod)
FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(5*10**6,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)
FACT_INV.reverse()
def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]%mod*FACT_INV[a-b]%mod
    else:
        return 0
N,M=map(int,input().split())
ANS=0
ALL=Combi(N+M,N)-N
y=M
k=0
while True:
    y-=N
    k+=1
    if k==1:
        if y<=0:
            break
    if y<0:
        break
    ANS+=Combi(N+y,y)
print(ANS*pow(ALL,mod-2,mod)%mod)
            
            
            
        