結果

問題 No.8120 Aoki's Present for Takahashi
ユーザー あじゃじゃ
提出日時 2025-04-01 22:28:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 93,972 KB
最終ジャッジ日時 2025-04-01 23:15:57
合計ジャッジ時間 9,328 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

t1,t2,=map(int,input().split())
mod=998244353
class Comb:
    def __init__(self,sup,mod=998244353):
        self.sup=sup
        self.mod=mod
        self.inv=[1]
        self.fact=[1]
        for i in range(1,self.sup+1):
            self.fact.append((self.fact[-1]*i)%self.mod)
            self.inv.append((self.inv[-1]*pow(i,-1,mod))%self.mod)
    def C(self,n,r):
        assert(self.sup>n)
        if r>n :return 0
        return (self.fact[n]*self.inv[r]*self.inv[n-r])%self.mod
cm=Comb(200001)
for i in range(1,t1+1):
    if i==t2:
        print(-1)
        continue
    n,m=map(int,input().split())
    print(cm.C(m,n))
0