結果

問題 No.380 悪の台本
ユーザー papinianuspapinianus
提出日時 2016-09-23 13:09:35
言語 PHP
(8.3.4)
結果
AC  
実行時間 193 ms / 1,000 ms
コード長 1,037 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 30,424 KB
実行使用メモリ 34,704 KB
最終ジャッジ日時 2024-04-24 14:48:53
合計ジャッジ時間 1,184 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
30,808 KB
testcase_01 AC 39 ms
30,988 KB
testcase_02 AC 39 ms
31,216 KB
testcase_03 AC 35 ms
31,360 KB
testcase_04 AC 39 ms
30,916 KB
testcase_05 AC 52 ms
30,748 KB
testcase_06 AC 51 ms
30,888 KB
testcase_07 AC 193 ms
30,528 KB
testcase_08 AC 43 ms
34,704 KB
testcase_09 AC 48 ms
31,008 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$ans = false;
while(!feof(STDIN))
{
    if($ans !== false)
    {
        echo $ans.PHP_EOL;
    }
    $phrase = fgets(STDIN);
    // echo "--$phrase--\n";
    $phrase = explode(" ", $phrase);
    $who = array_shift($phrase);
    $find = true;
    switch($who)
    {
        case "digi":
            $pattern = "/.*nyo[^A-Za-z0-9]{0,3}$/i";
            break;
        case "petit":
            $pattern = "/.*nyu[^A-Za-z0-9]{0,3}$/i";
            break;
        case "rabi":
            $pattern = "/.*[A-Za-z0-9]+.*/i";
            break;
        case "gema":
            $pattern = "/.*gema[^A-Za-z0-9]{0,3}$/i";
            break;
        case "piyo":
            $pattern = "/.*pyo[^A-Za-z0-9]{0,3}$/i";
            break;
        default:
            $ans = "WRONG!";
            $find = false;
            break;
    }
    if(!$find)
    {
        continue;
    }
    $ret = preg_match($pattern, implode(" ", $phrase));
    if($ret)
    {
        $ans = "CORRECT (maybe)";
    }
    else
    {
        $ans = "WRONG!";
    }
}
0