結果

問題 No.185 和風
ユーザー NiraChaNiraCha
提出日時 2017-05-11 09:12:00
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 1,000 ms
コード長 159 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-10-13 10:58:04
合計ジャッジ時間 1,417 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,040 KB
testcase_01 AC 85 ms
15,060 KB
testcase_02 AC 82 ms
15,052 KB
testcase_03 AC 82 ms
15,048 KB
testcase_04 AC 86 ms
15,028 KB
testcase_05 AC 84 ms
15,296 KB
testcase_06 AC 86 ms
15,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
x,y=gets.split.map(&:to_i)
ans=y-x

(n-1).times do
  x,y=gets.split.map(&:to_i)
  if y-x!=ans
    ans = -1
    break
  end
end
puts ans>0 ? ans: -1
0