結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2015-04-26 22:13:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,051 bytes |
| コンパイル時間 | 800 ms |
| コンパイル使用メモリ | 99,504 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-05 02:55:33 |
| 合計ジャッジ時間 | 1,512 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
#include<valarray>
//#include<bits/stdc++.h>
//using namespace std;
using namespace std;
string s;
int main(){
cin >> s;
int maxt = INT_MIN;
for (int i = 0; i < s.size(); i++){
char kari = s[0];
s.erase(0, 1);
s.push_back(kari);
if (s[0] >= '0'&&s[0] <= '9'){
}
else{
continue;
}
if (s.back() >= '0'&&s.back() <= '9'){
}
else{
continue;
}
stringstream ss;
ss << s;
int kk = 0;
ss >> kk;
char op;
while (ss >> op){
int num;
ss >> num;
if (op == '-'){
kk -= num;
}
else{
kk += num;
}
}
maxt = max(maxt, kk);
}
printf("%d\n", maxt);
return 0;
}
Kmcode1