結果

問題 No.185 和風
ユーザー 👑 horiesinitihoriesiniti
提出日時 2016-06-06 10:21:16
言語 Ruby
(3.3.0)
結果
AC  
実行時間 97 ms / 1,000 ms
コード長 244 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-17 05:10:13
合計ジャッジ時間 1,258 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
12,288 KB
testcase_01 AC 97 ms
12,288 KB
testcase_02 AC 92 ms
12,032 KB
testcase_03 AC 88 ms
12,160 KB
testcase_04 AC 87 ms
12,160 KB
testcase_05 AC 85 ms
12,160 KB
testcase_06 AC 89 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:24: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

# your code goes here
n=STDIN.gets.to_i
d=-1
ok=true
n.times do |i|
	a,b=STDIN.gets.split(" ")
	a=a.to_i
	b=b.to_i
	if d==-1
		if b>a
			d=b-a
		else
			ok=false
		end
	else
		if d!=b-a
			ok=false
		end
	end
end
if ok
	puts d
else
	puts -1
end
0