結果

問題 No.193 筒の数式
ユーザー fmhr
提出日時 2015-04-26 22:52:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-05 03:13:59
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding:utf-8

# 一番大きな数を最初ににして
# 最後に - (小さな数)を -の数だけやる

S = str(input())
num = []
p = 0
m = 0
for i in S:
    if i == '+':
        p += 1
    elif i == '-':
        m += 1
    else:
        num.append(i)
num = list(reversed(sorted(num)))
# print(num)
num_m = 0
for i in range(m):
    num_m += int(num.pop())
num_p = 0

for i in range(p):
    num_p += int(num.pop())
foo = ''.join(num)
# print(foo,num_p,num_m)
print(int(foo)+num_p-num_m)
0