結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
tjake
|
| 提出日時 | 2015-12-19 15:30:05 |
| 言語 | Python2 (2.7.18) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 373 bytes |
| コンパイル時間 | 529 ms |
| コンパイル使用メモリ | 6,784 KB |
| 実行使用メモリ | 11,776 KB |
| 最終ジャッジ日時 | 2024-09-16 16:05:57 |
| 合計ジャッジ時間 | 2,958 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 RE * 1 TLE * 1 -- * 13 |
ソースコード
from itertools import permutations
n = input()
c = raw_input().split()
mi = 10**9
ma = -10**9
join = ''.join
for p in permutations(c):
if p[0] in "+-" or p[-1] in "+-": continue
for i in xrange(n-1):
if p[i] in "+-" and p[i+1] in "+-":
break
else:
res = eval(join(p))
mi = min(mi, res)
ma = max(ma, res)
print ma, mi
tjake