結果

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

ソースコード

diff #

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

int main(void) {
	string s;
	cin >> s;
	bool flag = 0;
	int count = 0;
	int now,ans=-1;
	for (int i = 0; i < s.length(); ++i) {
		count=0;
		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){
					ans=i-now+1;
				}
			}
		}
	}
	cout<<ans<<endl;
}
0