結果

問題 No.602 隠されていたゲーム2
ユーザー mai
提出日時 2017-12-02 01:16:49
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-11-28 02:03:12
合計ジャッジ時間 2,897 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:30: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:15: warning: assigned but unused variable - dmax
Syntax OK

ソースコード

diff #

gets
d = gets.split.map(&:to_i)
x1,y1 = gets.split.map(&:to_i)
z = [x1+y1,x1-y1].map(&:abs).max

if z==0
    p 0;exit
end

if d.include?(z)
    p 1;exit
end


dmax = d.max

d.each do |e|
    
    if z < e && ( e.odd? || (e.even? && z.even?))
        p 2;exit
    end
end

d.each do |e| 
    if ((z+e-1)/e) <= 2 && ( e.odd? || (e.even? && z.even?))
        p (z+e-1)/e;exit
    end
end

p -1
0