結果

問題 No.193 筒の数式
ユーザー fmhrfmhr
提出日時 2015-04-26 22:52:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 7,900 KB
最終ジャッジ日時 2023-09-18 12:20:58
合計ジャッジ時間 1,253 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 15 ms
7,732 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
7,772 KB
testcase_07 WA -
testcase_08 AC 15 ms
7,816 KB
testcase_09 WA -
testcase_10 AC 15 ms
7,772 KB
testcase_11 AC 16 ms
7,852 KB
testcase_12 WA -
testcase_13 AC 15 ms
7,832 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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