結果

問題 No.10 +か×か
ユーザー Kude
提出日時 2020-09-03 08:40:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 358 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 128,128 KB
最終ジャッジ日時 2024-11-22 19:24:17
合計ジャッジ時間 23,544 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 3 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product
n = int(input())
tot = int(input())
a = list(map(int, input().split()))
for p in product(range(2), repeat=n-1):
    cur = a[0]
    for i in range(n - 1):
        if p[i]:
            cur += a[i + 1]
        else:
            cur *= a[i + 1]
    if cur == tot:
        print(''.join('+' if op else '*' for op in p))
        break
0