結果

問題 No.185 和風
ユーザー らっしー(raccy)らっしー(raccy)
提出日時 2015-04-19 23:43:19
言語 Ruby
(3.2.2)
結果
AC  
実行時間 88 ms / 1,000 ms
コード長 206 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 11,528 KB
実行使用メモリ 15,168 KB
最終ジャッジ日時 2023-09-18 01:47:39
合計ジャッジ時間 1,279 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,168 KB
testcase_01 AC 83 ms
15,028 KB
testcase_02 AC 80 ms
14,968 KB
testcase_03 AC 81 ms
15,140 KB
testcase_04 AC 81 ms
15,136 KB
testcase_05 AC 79 ms
15,112 KB
testcase_06 AC 82 ms
15,028 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:12: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = -1
gets.to_i.times do
  a, b = gets.split.map(&:to_i)
  if n < 0
    n = b - a
    if n < 1
      puts -1
      exit
    end
  else
    if n != (b - a)
      puts -1
      exit
    end
  end
end
puts n
0