結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-26 16:32:56 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 402 bytes |
| コンパイル時間 | 84 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 17:41:19 |
| 合計ジャッジ時間 | 1,214 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / 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)