結果

問題 No.341 沈黙の期間
ユーザー papinianuspapinianus
提出日時 2016-07-28 09:27:33
言語 PHP
(8.3.4)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 524 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 30,824 KB
実行使用メモリ 31,380 KB
最終ジャッジ日時 2024-04-24 10:29:48
合計ジャッジ時間 1,309 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
31,180 KB
testcase_01 AC 36 ms
31,344 KB
testcase_02 AC 36 ms
31,268 KB
testcase_03 AC 35 ms
31,116 KB
testcase_04 AC 35 ms
31,380 KB
testcase_05 AC 34 ms
31,060 KB
testcase_06 AC 37 ms
31,128 KB
testcase_07 AC 35 ms
31,236 KB
testcase_08 AC 35 ms
31,196 KB
testcase_09 AC 35 ms
31,212 KB
testcase_10 AC 36 ms
31,148 KB
testcase_11 AC 40 ms
31,124 KB
testcase_12 AC 36 ms
31,076 KB
testcase_13 AC 35 ms
31,196 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