結果

問題 No.345 最小チワワ問題
ユーザー hu_nbkhu_nbk
提出日時 2016-02-29 03:04:58
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 32,320 KB
実行使用メモリ 32,444 KB
最終ジャッジ日時 2023-10-24 19:06:20
合計ジャッジ時間 2,971 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
32,444 KB
testcase_01 AC 44 ms
32,444 KB
testcase_02 AC 41 ms
32,444 KB
testcase_03 AC 42 ms
32,444 KB
testcase_04 WA -
testcase_05 AC 41 ms
32,444 KB
testcase_06 AC 42 ms
32,444 KB
testcase_07 AC 42 ms
32,444 KB
testcase_08 AC 42 ms
32,444 KB
testcase_09 AC 43 ms
32,444 KB
testcase_10 AC 43 ms
32,444 KB
testcase_11 AC 43 ms
32,444 KB
testcase_12 AC 40 ms
32,444 KB
testcase_13 AC 42 ms
32,444 KB
testcase_14 AC 41 ms
32,444 KB
testcase_15 WA -
testcase_16 AC 42 ms
32,444 KB
testcase_17 AC 43 ms
32,444 KB
testcase_18 WA -
testcase_19 AC 42 ms
32,444 KB
testcase_20 AC 42 ms
32,444 KB
testcase_21 AC 43 ms
32,444 KB
testcase_22 AC 42 ms
32,444 KB
testcase_23 AC 41 ms
32,444 KB
testcase_24 WA -
testcase_25 AC 41 ms
32,444 KB
testcase_26 AC 43 ms
32,444 KB
testcase_27 AC 42 ms
32,444 KB
testcase_28 AC 41 ms
32,444 KB
testcase_29 AC 41 ms
32,444 KB
testcase_30 WA -
testcase_31 AC 43 ms
32,444 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$min = 100;
$flag =0;
$in = trim(fgets(STDIN));
for($i=0;$i<strlen($in);$i++){
    if($in[$i]=="c"){
        for($j=$i+1;$j<strlen($in);$j++){
            if($in[$j]=="w"){
                if($flag==1){
                    $flag=0;
                    if($j-$i+1<$min)$min=$j-$i+1;
                    break;
                }
                else{
                    $flag=1;
                    if($j-$i+1>=$min){break;}
                }
            }
        }
   }
}
if($min==100)$min=-1;
print $min;
0