結果

問題 No.222 引き算と足し算
ユーザー kichirb3kichirb3
提出日時 2018-03-17 12:27:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 491 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 10,712 KB
実行使用メモリ 9,108 KB
最終ジャッジ日時 2023-08-25 15:38:40
合計ジャッジ時間 2,756 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
9,020 KB
testcase_01 AC 23 ms
9,056 KB
testcase_02 AC 23 ms
8,956 KB
testcase_03 AC 22 ms
9,028 KB
testcase_04 AC 23 ms
8,980 KB
testcase_05 AC 23 ms
9,108 KB
testcase_06 AC 24 ms
9,064 KB
testcase_07 AC 24 ms
9,024 KB
testcase_08 AC 24 ms
9,036 KB
testcase_09 AC 24 ms
9,020 KB
testcase_10 AC 26 ms
9,016 KB
testcase_11 AC 24 ms
9,056 KB
testcase_12 AC 23 ms
8,984 KB
testcase_13 AC 23 ms
9,024 KB
testcase_14 AC 24 ms
9,024 KB
testcase_15 AC 24 ms
9,068 KB
testcase_16 AC 23 ms
9,052 KB
testcase_17 AC 25 ms
9,016 KB
testcase_18 AC 24 ms
9,048 KB
testcase_19 AC 23 ms
8,948 KB
testcase_20 AC 24 ms
9,032 KB
testcase_21 AC 24 ms
8,996 KB
testcase_22 AC 23 ms
8,976 KB
testcase_23 AC 24 ms
8,980 KB
testcase_24 AC 23 ms
9,036 KB
testcase_25 AC 24 ms
8,960 KB
testcase_26 AC 25 ms
8,956 KB
testcase_27 AC 24 ms
8,932 KB
testcase_28 AC 23 ms
9,060 KB
testcase_29 AC 24 ms
8,976 KB
testcase_30 AC 24 ms
9,020 KB
testcase_31 AC 24 ms
9,032 KB
testcase_32 AC 24 ms
8,936 KB
testcase_33 AC 25 ms
9,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
"""
No.222 引き算と足し算
https://yukicoder.me/problems/no/222

"""
import sys
from sys import stdin
import re
input = stdin.readline


def solve(e):
    m = re.search('\D', e[1:])
    pos = m.start() + 1
    if e[pos] == '-':
        t = e[:pos] + '+' + e[pos+1:]
    else:
        t = e[:pos] + '-' + e[pos+1:]
    return eval(t)


def main(args):
    e = input().strip()
    ans = solve(e)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])
0