結果

問題 No.708 (+ー)の式
ユーザー ミドリムシミドリムシ
提出日時 2018-02-20 18:53:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 65,048 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-28 11:34:17
合計ジャッジ時間 1,438 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
    string S;
    cin >> S;
    int zero = 0;
    bool number = true;
    bool bracket = false;
    for(int i = 0; i < S.size(); i++){
        if('0' <= S[i] && S[i] <= '9'){
            if(!number){
                cout << 3 / zero << endl;
            }
            number = false;
        }else if(S[i] == '+' || S[i] == '-'){
            if(number){
                cout << 3 / zero << endl;
            }
            number = true;
        }else if(S[i] == '('){
            if(bracket){
                cout << 3 / zero << endl;
            }
            bracket = true;
        }else{
            if(!bracket){
                cout << 3 / zero << endl;
            }
            bracket = false;
        }
    }
    if(bracket || number){
        cout << 3 / zero << endl;
    }
    cout << "fin" << endl;
}
0