結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
taba
|
| 提出日時 | 2016-04-15 03:19:30 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 389 bytes |
| コンパイル時間 | 125 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-04 09:18:23 |
| 合計ジャッジ時間 | 1,285 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 20 RE * 3 |
ソースコード
n=input()
c=raw_input().split()
a=sorted([i for i in c if i.isdigit()])
p,m=c.count("+"),c.count("-")
print a,p,m
#big
b=a[p+m:][::-1]
c=a[:p+m]
for i in range(m):
b+=["-",c.pop(0)]
for i in range(p):
b+=["+",c.pop()]
big=eval("".join(b))
#small
b=[a[0]]
c=a[1:]
for i in range(p):
b+=["+",c.pop(0)]
for i in range(m):
b+=["-",c.pop()]
b+=c[::-1]
small=eval("".join(b))
print big,small
taba