結果

問題 No.185 和風
ユーザー mondomondo
提出日時 2019-07-30 10:33:40
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 396 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 12,088 KB
実行使用メモリ 12,424 KB
最終ジャッジ日時 2023-09-15 12:13:43
合計ジャッジ時間 864 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
12,332 KB
testcase_01 AC 8 ms
12,392 KB
testcase_02 WA -
testcase_03 AC 8 ms
12,332 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 8 ms
12,396 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);
foreach ($array as $key => $value){
    if ($array[$key] == $array[$key - 1]) {
        $ans = $array[0];
    } else {
        $ans = "-1";
    }
}
echo $ans;

0