結果

問題 No.345 最小チワワ問題
ユーザー xuelei
提出日時 2018-07-16 14:17:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 63,744 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 08:14:55
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
	string str;
	cin >> str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='c'){
			for(int j=i+1;j<str.size();j++){
				if(str[j]=='c') i=j;
				if(str[j]=='w'){
					for(int k=j+1;k<str.size();k++){
						if(str[k]=='w'){
							cout << k-i+1 << endl;
							return 0;
						}
					}
				}
			}
		}
	}
	cout << -1 << endl;
	return 0;
}
0