結果

問題 No.297 カードの数式
ユーザー tabataba
提出日時 2016-04-15 03:21:53
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 419 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 01:43:25
合計ジャッジ時間 1,065 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 11 ms
6,940 KB
testcase_02 AC 11 ms
6,940 KB
testcase_03 RE -
testcase_04 AC 11 ms
6,944 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 11 ms
6,944 KB
testcase_08 AC 11 ms
6,940 KB
testcase_09 AC 10 ms
6,940 KB
testcase_10 AC 10 ms
6,944 KB
testcase_11 AC 10 ms
6,944 KB
testcase_12 AC 10 ms
6,940 KB
testcase_13 AC 11 ms
6,944 KB
testcase_14 AC 11 ms
6,940 KB
testcase_15 AC 11 ms
6,944 KB
testcase_16 AC 10 ms
6,940 KB
testcase_17 AC 11 ms
6,940 KB
testcase_18 AC 11 ms
6,940 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 10 ms
6,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
#print b
#small
b=[a[0]]
c=a[1:]
for i in range(p):
	b+=["+",c.pop(0)]
for i in range(m-1):
	b+=["-",c.pop(0)]
b+=["-"]+c[::-1]
small=eval("".join(b))
#print b,c
print big,small
0