結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 41 ms
31,024 KB
testcase_02 AC 40 ms
30,664 KB
testcase_03 AC 40 ms
30,952 KB
testcase_04 AC 40 ms
30,952 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 40 ms
31,036 KB
testcase_08 AC 40 ms
31,116 KB
testcase_09 WA -
testcase_10 AC 40 ms
30,948 KB
testcase_11 AC 40 ms
30,804 KB
testcase_12 AC 41 ms
30,832 KB
testcase_13 WA -
testcase_14 AC 40 ms
30,816 KB
testcase_15 AC 39 ms
30,812 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 41 ms
31,140 KB
testcase_19 AC 42 ms
30,644 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