結果

問題 No.201 yukicoderじゃんけん
ユーザー papinianuspapinianus
提出日時 2016-06-20 15:46:46
言語 PHP
(8.3.4)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 771 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 32,528 KB
実行使用メモリ 32,528 KB
最終ジャッジ日時 2024-04-19 21:19:58
合計ジャッジ時間 1,703 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
32,528 KB
testcase_01 AC 36 ms
32,528 KB
testcase_02 AC 36 ms
32,400 KB
testcase_03 AC 37 ms
32,528 KB
testcase_04 AC 35 ms
32,148 KB
testcase_05 AC 38 ms
32,272 KB
testcase_06 AC 36 ms
32,016 KB
testcase_07 AC 36 ms
32,144 KB
testcase_08 AC 37 ms
32,276 KB
testcase_09 AC 40 ms
32,020 KB
testcase_10 AC 37 ms
32,400 KB
testcase_11 AC 36 ms
32,400 KB
testcase_12 AC 36 ms
32,340 KB
testcase_13 AC 36 ms
32,528 KB
testcase_14 AC 35 ms
32,404 KB
testcase_15 AC 37 ms
32,272 KB
testcase_16 AC 37 ms
32,400 KB
testcase_17 AC 36 ms
32,400 KB
testcase_18 AC 36 ms
32,400 KB
testcase_19 AC 37 ms
32,400 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($first_name, $first_point, $devnull) = explode(' ', trim(fgets(STDIN)));
list($second_name, $second_point, $devnull) = explode(' ', trim(fgets(STDIN)));
if(my_strcmp($first_point,$second_point)==0) {
    echo '-1';
} else if(my_strcmp($first_point,$second_point)>0) {
    echo $first_name;
} else {
    echo $second_name;
}
echo PHP_EOL;
function my_strcmp($str1, $str2) {
    $len1 = strlen($str1);
    $len2 = strlen($str2);
    if($len1 > $len2) {
        return 1;
    } else if($len2 > $len1) {
        return -1;
    } else {
        for($i = 0; $i < $len1; $i++){
            if($str1[$i] > $str2[$i]) {
                return 1;
            } else if($str1[$i] < $str2[$i]) {
                return -1;
            }
        }
        return 0;
    }
}
0