結果

問題 No.2562 数字探しゲーム(緑以下コンver.)
ユーザー Nikkuniku029Nikkuniku029
提出日時 2023-12-02 16:10:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 496 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 327,300 KB
最終ジャッジ日時 2023-12-02 16:10:50
合計ジャッジ時間 7,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 240 ms
168,276 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(M, A):
    from itertools import permutations

    digit = []
    for i in range(9):
        for _ in range(A[i]):
            digit.append(i + 1)
    P = list(permutations(digit))
    for per in P:
        tmp = 0
        for c in per:
            tmp *= 10
            tmp += c
        if tmp % M == 0:
            return tmp


ans = []
T = int(input())
for _ in range(T):
    M = int(input())
    A = list(map(int, input().split()))
    ans.append(solve(M, A))
print(*ans, sep="\n")
0