結果

問題 No.345 最小チワワ問題
ユーザー かぼちゃ
提出日時 2018-03-28 17:04:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 60,468 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 13:12:40
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    bool c = false,w = false;
    for(int i = 0;i < s.length();i++){
        if(s[i] == 'c'){
            c = true;
        }
        else if(!w && s[i] == 'w'){
            c = false;
            w = true;
        }
        else if(w && s[i] == 'w'){
            w = false;
        }
        if(c)ans++;
        if(w)ans++;
    }
    cout << ans;
    return 0;
}
0