結果
問題 |
No.1631 Sorting Integers (Multiple of K) Easy
|
ユーザー |
|
提出日時 | 2021-12-27 22:58:39 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 81,980 KB |
実行使用メモリ | 115,768 KB |
最終ジャッジ日時 | 2024-10-01 09:38:50 |
合計ジャッジ時間 | 5,953 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 TLE * 1 -- * 17 |
ソースコード
from itertools import permutations n, k = map(int, input().split()) C = list(map(int, input().split())) L = [] for i in range(9): 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)