結果

問題 No.547 未知の言語
コンテスト
ユーザー tookunn_1213
提出日時 2017-08-03 21:44:17
言語 PHP
(8.5.2)
コンパイル:
php -l _filename_
実行:
php _filename_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,562 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,874 ms
コンパイル使用メモリ 37,368 KB
実行使用メモリ 38,384 KB
最終ジャッジ日時 2026-03-12 15:17:46
合計ジャッジ時間 3,689 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
PHP Deprecated:  Non-canonical cast (double) is deprecated, use the (float) cast instead in Main.php on line 40

Deprecated: Non-canonical cast (double) is deprecated, use the (float) cast instead in Main.php on line 40
No syntax errors detected in Main.php

ソースコード

diff #
raw source code

<?php
    class In {
        private $arr = [];
        private $count = 0;
        private $pointer = 0;

        public function next_line() {
            $ret = "";
            if($this->has_next()){
                while($this->has_next()){
                    $ret .= $this->next();
                }
            }else{
                $ret = trim(fgets(STDIN));
            }
            return $ret;
        }

        public function next() {
            if(!$this->has_next()) {
                $str = trim(fgets(STDIN));
                $this->arr = explode(' ',$str);
                $this->count = count($this->arr);
                $this->pointer = 0;
            }
            $result = $this->arr[$this->pointer];
            $this->pointer++;
            return $result;
        }

        public function has_next() {
            return $this->pointer < $this->count;
        }

        public function next_int() {
            return (int)$this->next();
        }

        public function next_double() {
            return (double)$this->next();
        }
    }

    class Out {
        public static function println($str = "") {
            echo $str . PHP_EOL;
        }
    }

    $in = new In();

    $N = $in->next_int();
    for($i = 0;$i < $N;$i++) {
        $S[] = $in->next();
    }

    for($i = 0;$i < $N;$i++) {
        $T[] = $in->next();
    }

    for($i = 0;$i < $N;$i++) {
        if($S[$i] !== $T[$i]) {
            Out::println($i + 1);
            Out::println($S[$i]);
            Out::println($T[$i]);
        }
    }
?>
0