結果

問題 No.345 最小チワワ問題
ユーザー togaerrortogaerror
提出日時 2016-04-03 17:23:33
言語 Raku
(rakudo v2024.02)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 146,428 KB
実行使用メモリ 147,948 KB
最終ジャッジ日時 2024-05-03 13:13:45
合計ジャッジ時間 15,224 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 436 ms
136,776 KB
testcase_01 AC 415 ms
136,628 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 431 ms
136,880 KB
testcase_05 AC 409 ms
137,008 KB
testcase_06 AC 424 ms
136,720 KB
testcase_07 AC 416 ms
137,012 KB
testcase_08 AC 427 ms
136,880 KB
testcase_09 AC 414 ms
136,592 KB
testcase_10 AC 410 ms
136,752 KB
testcase_11 AC 422 ms
137,140 KB
testcase_12 AC 423 ms
137,012 KB
testcase_13 AC 421 ms
136,884 KB
testcase_14 AC 410 ms
136,884 KB
testcase_15 AC 429 ms
136,852 KB
testcase_16 AC 417 ms
136,592 KB
testcase_17 WA -
testcase_18 AC 411 ms
136,596 KB
testcase_19 AC 412 ms
136,624 KB
testcase_20 AC 410 ms
136,756 KB
testcase_21 AC 408 ms
136,848 KB
testcase_22 AC 417 ms
137,264 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 407 ms
136,880 KB
testcase_29 AC 416 ms
136,752 KB
testcase_30 AC 415 ms
136,596 KB
testcase_31 AC 421 ms
137,268 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

use v6;

my $s = get();
chomp $s;
my @str = $s.split('');

my $count = 0;
my $long = 0;
my $keep = 0;
for @str -> $str {
	if $count > 0 {
		$long++;
	}

	if $str eq 'c' {
		$long  = 1;
		$count = 1;
	} elsif $str eq 'w' {
		if $count == 1 {
			$count++;
		} elsif $count == 2 {
			if $keep == 0 {
				$keep = $long;
			} elsif $long < $keep {
				$keep = $long;
			}
			$count = 0;
			$long = 0;
		}
	}
}

if $keep {
	say $keep;
} else {
	say "-1";
}

exit;
0