結果

問題 No.1644 Eight Digits
ユーザー lam6er
提出日時 2025-03-31 17:34:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 48 ms / 1,000 ms
コード長 253 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 66,980 KB
最終ジャッジ日時 2025-03-31 17:35:40
合計ジャッジ時間 2,604 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

K = int(input())
digits = [1, 2, 3, 4, 5, 6, 7, 8]
count = 0

for perm in itertools.permutations(digits):
    current = 0
    for d in perm:
        current = (current * 10 + d) % K
    if current == 0:
        count += 1

print(count)
0