結果

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

ソースコード

diff #

from itertools import combinations

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

ans = 0
for comb in combinations(range(N), K):
    S998 = 0
    S998244353 = 0
    for c in comb:
        S998 = (S998 + A[c]) % 998
        S998244353 = (S998244353 + A[c]) % 998244353

    if S998244353 <= S998:
        ans += 1
print(ans%998)
0