結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
hitoyozake
|
| 提出日時 | 2020-03-05 00:13:29 |
| 言語 | C++17(clang) (17.0.6 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| 記録 | |
| コンパイル時間 | 952 ms |
| コンパイル使用メモリ | 120,192 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 02:08:02 |
| 合計ジャッジ時間 | 1,570 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
ソースコード
#include <iostream>
#include <string>
#include <utility>
int main(){
std::string s;
std::cin >> s;
int n = 0;
int sum = 0;
for(auto const c : s){
if( c >= '0' && c <= '9'){
n *= 10;
n += std::stoi(std::string(1, c));
}
else{
if(c=='+'){
sum += n;
}
else if(c=='-'){
sum *= n;
}
n = 0;
}
}
std::cout << sum << std::endl;
}
hitoyozake