結果

問題 No.2561 みんな大好きmod 998
ユーザー sA_3sA_3
提出日時 2023-12-02 15:19:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,877 ms / 4,000 ms
コード長 560 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 99,876 KB
最終ジャッジ日時 2023-12-02 15:19:53
合計ジャッジ時間 35,031 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,716 KB
testcase_01 AC 166 ms
76,452 KB
testcase_02 AC 37 ms
53,716 KB
testcase_03 AC 2,871 ms
99,876 KB
testcase_04 AC 2,875 ms
99,876 KB
testcase_05 AC 2,868 ms
99,876 KB
testcase_06 AC 2,873 ms
99,876 KB
testcase_07 AC 38 ms
53,716 KB
testcase_08 AC 38 ms
53,716 KB
testcase_09 AC 50 ms
68,560 KB
testcase_10 AC 37 ms
53,716 KB
testcase_11 AC 366 ms
79,220 KB
testcase_12 AC 37 ms
53,716 KB
testcase_13 AC 37 ms
53,716 KB
testcase_14 AC 37 ms
53,716 KB
testcase_15 AC 2,862 ms
99,876 KB
testcase_16 AC 37 ms
53,716 KB
testcase_17 AC 37 ms
53,716 KB
testcase_18 AC 43 ms
60,144 KB
testcase_19 AC 2,060 ms
92,812 KB
testcase_20 AC 46 ms
62,408 KB
testcase_21 AC 37 ms
53,716 KB
testcase_22 AC 39 ms
53,716 KB
testcase_23 AC 45 ms
60,144 KB
testcase_24 AC 38 ms
53,716 KB
testcase_25 AC 37 ms
53,716 KB
testcase_26 AC 486 ms
80,604 KB
testcase_27 AC 2,843 ms
99,876 KB
testcase_28 AC 634 ms
82,404 KB
testcase_29 AC 212 ms
77,380 KB
testcase_30 AC 704 ms
81,212 KB
testcase_31 AC 1,471 ms
87,672 KB
testcase_32 AC 252 ms
78,408 KB
testcase_33 AC 213 ms
77,380 KB
testcase_34 AC 2,877 ms
99,876 KB
testcase_35 AC 175 ms
77,264 KB
testcase_36 AC 179 ms
77,264 KB
testcase_37 AC 105 ms
76,256 KB
testcase_38 AC 366 ms
79,220 KB
testcase_39 AC 731 ms
81,212 KB
testcase_40 AC 713 ms
81,212 KB
testcase_41 AC 373 ms
79,220 KB
testcase_42 AC 631 ms
82,404 KB
testcase_43 AC 105 ms
76,256 KB
testcase_44 AC 281 ms
78,168 KB
testcase_45 AC 2,076 ms
92,812 KB
testcase_46 AC 208 ms
77,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math
def comb(n,r):
    return math.factorial(n)//(math.factorial(n-r) * math.factorial(r))

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

lis = [i for i in range(N)]
result = [0 for _ in range(comb(N,K))]
ct = 0
for conb in itertools.combinations(lis, K):
    # result.append(list(conb)) #タプルをリスト型に変換
    for j in range(K):
        result[ct] += A[list(conb)[j]]
    ct += 1

ans = 0
for k in range(len(result)):
    if result[k]%998244353 <= result[k]%998:
        ans += 1

print(ans%998)

0