結果

問題 No.185 和風
ユーザー Lycoris_i
提出日時 2015-09-06 18:25:36
言語 Ruby
(3.4.1)
結果
AC  
実行時間 89 ms / 1,000 ms
コード長 231 bytes
コンパイル時間 55 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-07-19 04:41:11
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:11: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
x = Array.new
y = Array.new
n.times {|i|
  x[i], y[i] = gets.split(" ").map(&:to_i)
  if y[i] - x[i] < 1
    puts -1
    exit
  end
  if y[i] - x[i] != y[i - 1] - x[i - 1]
    puts -1
    exit
  end
}
puts y[0] - x[0]
0