結果

問題 No.345 最小チワワ問題
ユーザー albicilla
提出日時 2016-03-01 00:15:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 55,600 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 12:57:38
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstring>
using namespace std;
int main() {
    int cnt=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='c'){
            for(int j=i;j<s.size();j++){
                if(s[j]=='w'){
                    cnt++;
                }
                    
                if(cnt==2){
                    cout<<j-i+1<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"-1"<<endl;
    return 0;
}
0