結果

問題 No.341 沈黙の期間
ユーザー papinianuspapinianus
提出日時 2016-07-28 09:27:33
言語 PHP
(8.3.4)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 524 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 18,520 KB
実行使用メモリ 19,080 KB
最終ジャッジ日時 2023-08-06 15:00:53
合計ジャッジ時間 1,077 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,956 KB
testcase_01 AC 15 ms
18,864 KB
testcase_02 AC 15 ms
18,988 KB
testcase_03 AC 15 ms
18,896 KB
testcase_04 AC 15 ms
19,080 KB
testcase_05 AC 15 ms
18,844 KB
testcase_06 AC 15 ms
18,928 KB
testcase_07 AC 14 ms
19,008 KB
testcase_08 AC 15 ms
18,900 KB
testcase_09 AC 15 ms
19,072 KB
testcase_10 AC 15 ms
18,660 KB
testcase_11 AC 14 ms
19,016 KB
testcase_12 AC 15 ms
18,988 KB
testcase_13 AC 15 ms
18,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$str = preg_split("//u", trim(fgets(STDIN)));
$len = count($str);
$start = false;
$max = 0;
$cnt = 0;
for($i = 0; $i < $len; $i++) {
    if($str[$i]=="…") {
        if(!$start) { 
            $start = true;
            $cnt = 1;
        } else {
            $cnt++;
        }
    } else {
        if($start) {
            $max = max($max, $cnt);
            $start = false;
            $cnt = 0;
        }
    }
}
if($start) {
    $max = max($max, $cnt);
    $start = false;
    $cnt = 0;
}
echo $max;

echo PHP_EOL;
0