結果

問題 No.1631 Sorting Integers (Multiple of K) Easy
ユーザー lloyzlloyz
提出日時 2021-12-27 22:57:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 380 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 115,620 KB
最終ジャッジ日時 2024-04-08 17:35:26
合計ジャッジ時間 3,588 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 41 ms
53,460 KB
testcase_02 AC 40 ms
53,460 KB
testcase_03 AC 246 ms
115,620 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 42 ms
53,460 KB
testcase_07 AC 37 ms
53,460 KB
testcase_08 RE -
testcase_09 WA -
testcase_10 AC 48 ms
64,436 KB
testcase_11 AC 48 ms
64,428 KB
testcase_12 WA -
testcase_13 AC 47 ms
64,428 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

n, k = map(int, input().split())
C = list(map(int, input().split()))
L = []
for i in range(n):
    for num in range(C[i]):
        L.append(str(i + 1))

ans = 0
seen = set()
for P in permutations(L):
    num = ''.join(P)
    num = int(num)
    if num in seen:
        continue
    seen.add(num)
    if num % k == 0:
        ans += 1
print(ans)
0