結果

問題 No.345 最小チワワ問題
ユーザー 重荷重荷
提出日時 2016-03-17 12:03:29
言語 PHP
(8.3.4)
結果
RE  
実行時間 -
コード長 774 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 32,540 KB
実行使用メモリ 32,800 KB
最終ジャッジ日時 2024-04-08 16:42:16
合計ジャッジ時間 2,716 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

<?php
$cStr = trim(fgets(STDIN));
if(cwwCheck($cStr)){
    
    
    $work = substr($cStr, strpos($cStr,'c'),
            strpos($cStr,'w',strpos($cStr,'w',strpos($cStr,'c'))+1)-$cStr);
    $start = strpos($cStr,'c');
    do{
        
        $work = substr($work, strpos($work,'c',2));
    }
    while(cwwCheck(substr($work, strpos($work,'c',2))));
    
    $ans = strpos($work,'w',strpos($work,'w',strpos($work,'c'))+1) - strpos($work,'c') + 1;
    //printf("$work");
    printf("$ans");
}else{
    printf("-1");
}

function cwwCheck($cStr){
    $flg=false;
    if(strpos($cStr,'c') !== false  && 
    strpos($cStr,'w',strpos($cStr,'c')) !== false && 
        strpos($cStr,'w',strpos($cStr,'w',strpos($cStr,'c'))+1) !== false){
        $flg=true;
    }
    return $flg;
}
0