結果

問題 No.345 最小チワワ問題
ユーザー togatogatogatoga
提出日時 2016-04-26 13:34:41
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 466 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 41,196 KB
最終ジャッジ日時 2024-04-21 01:19:44
合計ジャッジ時間 3,237 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
41,196 KB
testcase_01 AC 69 ms
39,168 KB
testcase_02 AC 64 ms
39,296 KB
testcase_03 AC 64 ms
39,168 KB
testcase_04 AC 65 ms
39,424 KB
testcase_05 AC 64 ms
39,296 KB
testcase_06 AC 66 ms
39,424 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 65 ms
39,168 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 65 ms
39,296 KB
testcase_15 AC 64 ms
39,296 KB
testcase_16 AC 64 ms
39,296 KB
testcase_17 AC 64 ms
39,168 KB
testcase_18 AC 64 ms
39,296 KB
testcase_19 AC 65 ms
39,040 KB
testcase_20 AC 66 ms
39,424 KB
testcase_21 WA -
testcase_22 AC 65 ms
39,168 KB
testcase_23 AC 66 ms
39,424 KB
testcase_24 AC 64 ms
39,168 KB
testcase_25 AC 65 ms
39,552 KB
testcase_26 AC 64 ms
39,296 KB
testcase_27 AC 64 ms
39,296 KB
testcase_28 WA -
testcase_29 AC 67 ms
39,424 KB
testcase_30 AC 65 ms
39,296 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

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