結果

問題 No.185 和風
ユーザー togaerrortogaerror
提出日時 2015-04-21 09:39:34
言語 Perl
(5.38.2)
結果
AC  
実行時間 6 ms / 1,000 ms
コード長 307 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 5,328 KB
実行使用メモリ 5,056 KB
最終ジャッジ日時 2023-09-18 02:09:53
合計ジャッジ時間 862 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,056 KB
testcase_01 AC 5 ms
5,052 KB
testcase_02 AC 5 ms
4,820 KB
testcase_03 AC 5 ms
4,892 KB
testcase_04 AC 5 ms
4,820 KB
testcase_05 AC 5 ms
4,832 KB
testcase_06 AC 6 ms
4,756 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/evn perl

use strict;
use warnings;

my $n = <>;
my $i = 0;
my @array;

while($i < $n) {
	my($x, $y) = split / /, <>;
	$array[$i] = $y - $x;
	$i++;
}
$i = 1;
while($i < $n) {
	if(($array[$i - 1] != $array[$i])or($array[$i] <= 0)) {
		print "-1\n";
		exit;
	}
	$i++;
}

print "$array[0]\n";

exit;
0