結果

問題 No.10 +か×か
ユーザー nishigakenishigake
提出日時 2022-05-30 01:09:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 53,436 KB
最終ジャッジ日時 2023-10-21 00:16:12
合計ジャッジ時間 7,376 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N = int(input())
total = int(input())
A = list(map(int,input().split()))
stack = [(N-1,total,"")]
while stack:
    i,v,s = stack.pop()
    if i == 0:
        if v == A[i]:
            print(s)
            break
        continue
    if v % A[i] == 0:
        stack.append((i-1,v//A[i],"*"+s))
    if A[i] <= v:
        stack.append((i-1,v-A[i],"+"+s))

0