結果
| 問題 |
No.1334 Multiply or Add
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-07 20:47:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 313 ms |
| コンパイル使用メモリ | 81,816 KB |
| 実行使用メモリ | 320,884 KB |
| 最終ジャッジ日時 | 2024-06-25 14:29:59 |
| 合計ジャッジ時間 | 25,942 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 RE * 54 TLE * 1 -- * 2 |
ソースコード
# はじにある1は足したほうがよい
N = int(input())
A = input().split()
DIV = 10 ** 9 + 7
ans = 0
for i in range(1 << (N - 1)):
form = [A[0]]
for j in range(N - 1):
if (i >> j) & 1:
form.append("+")
else:
form.append("*")
form.append(A[j + 1])
val = eval("".join(form))
ans = max(ans, val)
print(ans % DIV)