結果

問題 No.345 最小チワワ問題
ユーザー togatoga
提出日時 2016-04-26 13:34:41
言語 JavaScript
(node v23.5.0)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 39,552 KB
最終ジャッジ日時 2024-10-12 23:39:37
合計ジャッジ時間 3,024 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 21 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main (input) {
	input = input.split("\n");
	// console.log(input);
	var tmp = input[0].split(" ")[0];
	var ans = 1145141919191919191810;
	for (var i = 0; i < tmp.length; i++){
		if (tmp[i] != 'c')continue;
		var cnt_w = 0;
		for (var j = i + 1; j < tmp.length; j++){
			if (tmp[j] == 'w'){
				cnt_w += 1;
			}
			if (cnt_w >= 2){
				ans = Math.min(ans, (j - i) + 1);
			}
		}
	}
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0