結果

問題 No.185 和風
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-10 00:36:52
言語 Ruby
(3.2.2)
結果
AC  
実行時間 88 ms / 1,000 ms
コード長 313 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 11,540 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-10-11 15:28:44
合計ジャッジ時間 1,307 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

n = gets.to_i
bef = -1
n.times do |i|
    a = gets.split.map(&:to_i)
    d = a[1].to_i - a[0].to_i
    if d <= 0
        puts -1
        exit
    else
        if bef == -1
            bef = d
        end    
        if d != bef
            puts -1
            exit
        end
        bef = d
    end
end
puts bef
0