結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,280 KB
testcase_01 AC 83 ms
15,256 KB
testcase_02 AC 81 ms
15,088 KB
testcase_03 AC 82 ms
15,036 KB
testcase_04 AC 85 ms
15,352 KB
testcase_05 AC 72 ms
15,052 KB
testcase_06 AC 79 ms
15,056 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 (y-x==ans&&ans>0) ? ans: -1
0