結果

問題 No.345 最小チワワ問題
ユーザー nninjinn00
提出日時 2017-02-26 11:00:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 56,092 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-11 16:34:14
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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