結果

問題 No.222 引き算と足し算
ユーザー 👑 rin204
提出日時 2022-01-20 07:57:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 1,000 ms
コード長 260 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-11-23 14:21:16
合計ジャッジ時間 2,533 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

eq = input()
n = len(eq)
flg = False
for i in range(n):
    if eq[i].isdigit():
        flg = True
    elif flg and eq[i] in "+-":
        ope = eq[i]
        break
    
x = int(eq[:i])
y = int(eq[i + 1:])
if ope == "+":
    print(x - y)
else:
    print(x + y)
0