結果
| 問題 | No.2561 みんな大好きmod 998 | 
| コンテスト | |
| ユーザー |  あ | 
| 提出日時 | 2023-12-13 23:16:14 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 551 ms / 4,000 ms | 
| コード長 | 358 bytes | 
| コンパイル時間 | 457 ms | 
| コンパイル使用メモリ | 82,832 KB | 
| 実行使用メモリ | 75,704 KB | 
| 最終ジャッジ日時 | 2024-09-27 05:32:45 | 
| 合計ジャッジ時間 | 9,249 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 44 | 
ソースコード
from itertools import combinations
mod1 = 998
mod2 = 998244353
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for v in combinations(range(n), k):
    s1 = 0
    s2 = 0
    for i in v:
        s1 += a[i]
        s1 %= mod1
        s2 += a[i]
        s2 %= mod2
    if s2 <= s1:
        ans += 1
        ans %= mod1
print(ans)
            
            
            
        