結果

問題 No.306 さいたま2008
ユーザー simansiman
提出日時 2016-03-26 22:21:43
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-10-02 01:04:56
合計ジャッジ時間 2,852 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class Yukicoder
  def initialize
    x1, y1 = gets.chomp.split.map(&:to_i)
    x2, y2 = gets.chomp.split.map(&:to_i)

    if y1 > y2
      a = x1 + x2
      b = y1 - y2

      if x1 > x2
        puts (x1 * Rational(b, a) + y2).to_f
      else
        puts (x2 * Rational(b, a) + y2).to_f
      end
    else
      a = x1 + x2
      b = y2 - y1

      if x1 > x2
        puts (x2 * Rational(b, a) + y1).to_f
      else
        puts (x1 * Rational(b, a) + y1).to_f
      end
    end
  end
end

Yukicoder.new
0