結果

問題 No.1631 Sorting Integers (Multiple of K) Easy
ユーザー lloyz
提出日時 2021-12-27 22:57:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 380 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 116,052 KB
最終ジャッジ日時 2024-10-01 09:37:21
合計ジャッジ時間 3,656 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 2 RE * 21
権限があれば一括ダウンロードができます

ソースコード

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