結果

問題 No.345 最小チワワ問題
ユーザー Noiri
提出日時 2017-12-09 01:13:21
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 508 bytes
コンパイル時間 805 ms
コンパイル使用メモリ 56,464 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-29 20:29:56
合計ジャッジ時間 2,046 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    string cww; cin >> cww;
    int count = 0;
    int line = cww.size();
    for(int i = 0; i < line; i++){
        if(cww[i] == 'c'){
            for(int j = i; j < line; j++){
                if(cww[j] == 'w') count += 1;
                if(count == 2){
                    cout << j - i + 1 << endl;
                    break;
                }
            }
        }
    }
    if(count != 2) cout << "-1" << endl;
    return 0;
}
0