結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
goodbaton
|
| 提出日時 | 2014-11-20 23:38:56 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 2 ms / 5,000 ms |
| + 131µs | |
| コード長 | 702 bytes |
| 記録 | |
| コンパイル時間 | 433 ms |
| コンパイル使用メモリ | 90,140 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-10-15 14:04:00 |
| 合計ジャッジ時間 | 2,145 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
int main(){
char s[110],en='*';
int ans=0,nu=0;
scanf("%s",s);
for(int i=0;s[i]!='\0';i++){
if(s[i]=='+' || s[i]=='*'){
if(en=='*')
ans+=nu;
else
ans*=nu;
en=s[i];
nu=0;
}else{
nu*=10;
nu+=s[i]-'0';
}
}
if(en=='*')
ans+=nu;
else
ans*=nu;
printf("%d\n",ans);
return 0;
}
goodbaton