結果

問題 No.185 和風
ユーザー 小指が強い人小指が強い人
提出日時 2015-11-10 00:35:48
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 312 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 11,480 KB
実行使用メモリ 15,336 KB
最終ジャッジ日時 2023-10-11 15:28:42
合計ジャッジ時間 1,380 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,008 KB
testcase_01 AC 84 ms
15,168 KB
testcase_02 AC 82 ms
15,304 KB
testcase_03 AC 84 ms
15,212 KB
testcase_04 AC 84 ms
15,144 KB
testcase_05 WA -
testcase_06 AC 86 ms
15,112 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