結果

問題 No.185 和風
ユーザー Lycoris_i
提出日時 2015-09-06 18:24:40
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-07-19 04:41:10
合計ジャッジ時間 1,138 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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] < 0
    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