結果
問題 |
No.138 化石のバージョン
|
ユーザー |
![]() |
提出日時 | 2020-01-12 12:32:05 |
言語 | PHP (843.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 694 bytes |
コンパイル時間 | 2,749 ms |
コンパイル使用メモリ | 30,864 KB |
実行使用メモリ | 31,664 KB |
最終ジャッジ日時 | 2024-11-28 16:12:26 |
合計ジャッジ時間 | 3,263 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 4 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $fossilVer = trim(fgets(STDIN)); $target = trim(fgets(STDIN)); $X = new something($target); $X->comparVer($fossilVer, $target); if($X->status == 'OLD'){ echo 'YES'; }else if($X->status == 'NEW'){ echo 'NO'; } class something{ public $version; public $status; function __construct($target){ $this->version = $target; } function comparVer($fossil, $tar){ $fos = explode('.', $fossil); $t = explode('.', $tar); if(!(count($fos) == count($t))){ die("ERROR!"); }else{ $roop = count($fos); } for($i = 0; $i < $roop; $i++){ if($fos[0] >= $t[0]){ continue; }else{ $this->status = 'NEW'; return; } } $this->status = 'OLD'; } }