結果
| 問題 | No.8062 A + B |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-30 23:42:21 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 502 bytes |
| 記録 | |
| コンパイル時間 | 3,488 ms |
| コンパイル使用メモリ | 337,124 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-01-30 23:42:27 |
| 合計ジャッジ時間 | 4,190 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void){
string a,b;
cin>>a>>b;
string s=a+b;
long long a1=0,ans=0;
int f=0;
for(int i=0;i<s.size();i++){
if(s[i]=='-'){
ans+=a1*(f==-1?-1:1);
f=-1;
a1=0;
}else if(s[i]=='+'){
ans+=a1;
a1=0;
f=0;
}else{
a1*=10;
a1+=s[i]-'0';
}
}
ans+=a1*(f==-1?-1:1);
cout <<ans<<endl;
return 0;
}