結果

問題 No.201 yukicoderじゃんけん
コンテスト
ユーザー
提出日時 2016-01-20 20:56:33
言語 PHP
(8.5.9)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
AC  
実行時間 33 ms / 5,000 ms
+ 10µs
コード長 738 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 39 ms
コンパイル使用メモリ 37,384 KB
実行使用メモリ 37,644 KB
最終ジャッジ日時 2026-09-01 16:59:36
合計ジャッジ時間 2,121 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php

$input1 = trim(fgets(STDIN));

list($player1,$player1Point,$player1hand) = explode(" ", $input1);

$str1 = strlen($player1Point);

$input2 = trim(fgets(STDIN));

list($player2,$player2Point,$player2hand) = explode(" ", $input2);

$str2 = strlen($player2Point);



if($str1 > $str2){
    $str2 = str_pad($str2,$str1,"0",STR_PAD_LEFT);
}else{
    $str1 = str_pad($str1,$str2,"0",STR_PAD_LEFT);
}

if($str1 < $str2){
    echo $player2."\n";
}else if($str1 > $str2){
    echo $player1."\n";
}

if($player1Point < $player2Point && $str1 == $str2){
    echo $player2."\n";
}else if($player1Point > $player2Point && $str1 == $str2){
    echo $player1."\n";
}else if($player1Point == $player2Point && $str1 == $str2){
    echo "-1"."\n";
}
0