結果
| 問題 | No.297 カードの数式 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-26 16:32:56 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 402 bytes |
| 記録 | |
| コンパイル時間 | 139 ms |
| コンパイル使用メモリ | 77,844 KB |
| 最終ジャッジ日時 | 2025-12-03 17:54:12 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 7 |
ソースコード
N = int(raw_input())
s = sorted(raw_input().split(), reverse = True)
for i in xrange(N):
if s[i] == "+" or s[i] == "-":
e = s[i:][::-1]
s = s[:i]
break
while len(s) > len(e) + 1:
t = s[0]
s = s[1:]
s[0] = t + s[0]
emx, emn = "", ""
for i in xrange(len(e)):
emx += s[i] + e[i]
emn += s[-i-1] + e[i]
emx += s[-1]
emn += s[0]
print eval(emx), eval(emn)