結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
yaoshimax
|
| 提出日時 | 2015-06-06 15:06:27 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 386 bytes |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-15 21:53:43 |
| 合計ジャッジ時間 | 1,422 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 5 |
ソースコード
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
yaoshimax