結果

問題 No.345 最小チワワ問題
ユーザー RCCW
提出日時 2017-02-07 23:38:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 1,470 ms
コンパイル使用メモリ 158,068 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 15:34:44
合計ジャッジ時間 2,263 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(void) {
	string s;
	cin >> s;
	bool flag = 0;
	int count = 0;
	int now;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] == 'c') {
			now=i;
			while (i < s.length()) {
				i++;
				if(s[i]=='w'&&count==0){
					count++;
				}else if(s[i]=='w'&&count==1){
					cout<<i-now+1<<endl;
					return 0;
				}
			}
		}
	}
	cout<<-1<<endl;
}
0