結果

問題 No.185 和風
ユーザー harhogefooharhogefoo
提出日時 2016-10-12 08:32:24
言語 Ruby
(3.2.2)
結果
AC  
実行時間 82 ms / 1,000 ms
コード長 231 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 11,508 KB
実行使用メモリ 15,292 KB
最終ジャッジ日時 2023-08-14 07:34:38
合計ジャッジ時間 1,245 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,280 KB
testcase_01 AC 82 ms
15,172 KB
testcase_02 AC 78 ms
15,012 KB
testcase_03 AC 81 ms
15,084 KB
testcase_04 AC 81 ms
15,292 KB
testcase_05 AC 80 ms
15,120 KB
testcase_06 AC 82 ms
15,156 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:12: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
x, y = gets.chomp.split(" ").map(&:to_i)
answer = y - x
(n-1).times do |i|
  x, y = gets.chomp.split(" ").map(&:to_i)
  if answer != y - x
    puts -1
    exit
  end
end
if answer <= 0
  puts -1
else
  puts answer
end
0