結果

問題 No.185 和風
ユーザー Lycoris_iLycoris_i
提出日時 2015-09-06 18:25:36
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 231 bytes
コンパイル時間 632 ms
コンパイル使用メモリ 11,072 KB
実行使用メモリ 15,292 KB
最終ジャッジ日時 2023-09-26 09:45:07
合計ジャッジ時間 1,331 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,260 KB
testcase_01 AC 86 ms
15,160 KB
testcase_02 AC 80 ms
15,032 KB
testcase_03 AC 85 ms
15,292 KB
testcase_04 AC 81 ms
15,292 KB
testcase_05 AC 82 ms
15,244 KB
testcase_06 AC 82 ms
15,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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