結果

問題 No.185 和風
ユーザー mondomondo
提出日時 2019-07-30 10:43:36
言語 PHP
(8.3.4)
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 475 bytes
コンパイル時間 582 ms
コンパイル使用メモリ 11,992 KB
実行使用メモリ 12,464 KB
最終ジャッジ日時 2023-09-17 00:18:52
合計ジャッジ時間 886 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
12,464 KB
testcase_01 AC 8 ms
12,464 KB
testcase_02 AC 7 ms
12,408 KB
testcase_03 AC 7 ms
12,384 KB
testcase_04 AC 8 ms
12,392 KB
testcase_05 AC 7 ms
12,408 KB
testcase_06 AC 7 ms
12,432 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$count= trim(fgets(STDIN));
$number = array();
$answer = 0;
for ($i = 0; $i < $count; $i++) {
     $number = explode(" ", trim(fgets(STDIN)));
     $answer = $number[1] - $number[0];
     $array[] = $answer;
}
// print_r($array);
$OK = 0;
$NG = 0;
foreach ($array as $key => $value){
    if ($array[$key] == $array[$key+1] && $array[$key] > 0) {
        $OK ++;
    } else {
        $NG ++;
    }
}
if ($OK == $count-1) {
    echo $array[0];
} else {
    echo "-1";
}

0