結果

問題 No.10 +か×か
ユーザー KudeKude
提出日時 2020-09-03 08:43:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 366 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 81,480 KB
最終ジャッジ日時 2023-08-14 19:27:20
合計ジャッジ時間 7,047 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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 not p[i]:
            cur += a[i + 1]
        else:
            cur *= a[i + 1]
    if cur == tot:
        print(''.join('+' if not op else '*' for op in p))
        break
0