結果

問題 No.201 yukicoderじゃんけん
ユーザー papinianus
提出日時 2016-06-20 15:44:52
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 6,594 ms
コンパイル使用メモリ 31,892 KB
実行使用メモリ 32,276 KB
最終ジャッジ日時 2024-10-11 13:40:10
合計ジャッジ時間 7,629 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
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