結果

問題 No.185 和風
ユーザー Lycoris_iLycoris_i
提出日時 2015-09-06 18:24:40
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,496 KB
実行使用メモリ 15,284 KB
最終ジャッジ日時 2023-09-26 09:45:04
合計ジャッジ時間 1,405 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,172 KB
testcase_01 AC 83 ms
15,128 KB
testcase_02 AC 79 ms
15,284 KB
testcase_03 AC 78 ms
15,104 KB
testcase_04 AC 78 ms
15,072 KB
testcase_05 WA -
testcase_06 AC 83 ms
15,016 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] < 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