提出 #1029464


ソースコード 拡げる

<?php
fscanf(STDIN, "%s", $t);
$sa = str_split($t);

$cnt = 0;
$max = 0;
for($i = 0;$i < count($sa); $i++) {
	$t = (($i % 2) === 0)? '2' : '5';

	if($cnt === 0 && $t === '5')continue;
	$cnt = ($sa[$i] === $t || $sa[$i] === '?') ? $cnt + 1:0;
	if($max < $cnt) $max = $cnt;
}
$cnt = 0;
for($i = 0;$i < count($sa); $i++) {
	$t = (($i % 2) === 0)? '5' : '2';

	if($cnt === 0 && $t === '5')continue;
	$cnt = ($sa[$i] === $t || $sa[$i] === '?') ? $cnt + 1:0;
	if($max < $cnt) $max = $cnt;
}
if($max % 2 === 1)$max = $max - 1;
print("$max\n");

?>

提出情報

提出日時
問題 B - ニコニコレベル
ユーザ aitti
言語 PHP (5.6.30)
得点 300
コード長 566 Byte
結果 AC
実行時間 116 ms
メモリ 21136 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 5
AC × 17
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_05.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, large_01.txt, large_02.txt, large_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 19 ms 3704 KiB
hand_02.txt AC 16 ms 3452 KiB
hand_03.txt AC 16 ms 3452 KiB
hand_04.txt AC 16 ms 3452 KiB
hand_05.txt AC 116 ms 21008 KiB
large_01.txt AC 114 ms 21008 KiB
large_02.txt AC 110 ms 21008 KiB
large_03.txt AC 110 ms 21008 KiB
random_01.txt AC 112 ms 21008 KiB
random_02.txt AC 111 ms 21008 KiB
random_03.txt AC 116 ms 21008 KiB
random_04.txt AC 110 ms 21136 KiB
sample_01.txt AC 16 ms 3452 KiB
sample_02.txt AC 16 ms 3452 KiB
sample_03.txt AC 16 ms 3452 KiB
sample_04.txt AC 16 ms 3452 KiB
sample_05.txt AC 16 ms 3452 KiB