結果

問題 No.185 和風
ユーザー mesh1nek0x0mesh1nek0x0
提出日時 2018-07-08 14:21:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 313 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 15,296 KB
最終ジャッジ日時 2023-09-21 10:05:52
合計ジャッジ時間 1,252 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,036 KB
testcase_01 AC 79 ms
15,296 KB
testcase_02 AC 76 ms
15,216 KB
testcase_03 AC 76 ms
15,260 KB
testcase_04 AC 76 ms
15,036 KB
testcase_05 AC 76 ms
15,288 KB
testcase_06 AC 78 ms
15,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/bin/ruby
N = gets.chomp.to_i

result = nil
N.times do |num|
  tmp = gets.chomp.split(' ')
  x = tmp[0].to_i
  y = tmp[1].to_i
  
  if num < 1
    result = y - x
    if result <= 0
      result = -1
      break
    end
  else
    if result != (y - x)
      result = -1
      break
    end
  end
end

puts result
0