結果

問題 No.222 引き算と足し算
コンテスト
ユーザー yaoshimax
提出日時 2015-06-06 15:06:27
言語 PyPy2
(7.3.20)
コンパイル:
pypy2 -m py_compile _filename_
実行:
/usr/bin/pypy2 Main.pyc
結果
WA  
実行時間 -
コード長 386 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 65 ms
コンパイル使用メモリ 80,128 KB
実行使用メモリ 80,896 KB
最終ジャッジ日時 2026-07-17 16:19:59
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S=raw_input()
s=1
x=0
ind=0
if(S[0]=='-'):
    s=-1
    ind+=1
if(S[0]=='+'):
    ind+=1
while S[ind]!='-' and S[ind]!='+':
    x*=10
    x+=ord(S[ind])-ord('0')
    ind+=1
x*=s
if(S[ind]=='-'):
    s=+1
    ind+=1
if(S[ind]=='+'):
    s=-1
    ind+=1
if(S[ind]=='-'):
    s*=-1
    ind+=1
if(S[ind]=='+'):
    ind+=1
y=0
for c in S[ind::]:
    y*=10
    y+=ord(c)-ord('0')
print x+s*y
0