結果

問題 No.2561 みんな大好きmod 998
ユーザー naut3
提出日時 2023-12-02 20:07:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 529 ms / 4,000 ms
コード長 295 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2024-09-26 21:36:40
合計ジャッジ時間 9,772 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

N, K = map(int, input().split())
A = list(map(int, input().split()))

M1 = 998
M2 = 998_244_353

ans = 0

for comb in combinations(A, K):
    s = sum(comb)

    if s % M1 >= s % M2:
        ans += 1

        if ans == M1:
            ans = 0

print(ans % M1)
0