結果
| 問題 | No.538 N.G.S. | 
| コンテスト | |
| ユーザー |  tubo28 | 
| 提出日時 | 2017-06-30 22:52:50 | 
| 言語 | Ruby (3.4.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 94 ms / 2,000 ms | 
| コード長 | 547 bytes | 
| コンパイル時間 | 235 ms | 
| コンパイル使用メモリ | 7,424 KB | 
| 実行使用メモリ | 12,416 KB | 
| 最終ジャッジ日時 | 2024-09-24 23:53:30 | 
| 合計ジャッジ時間 | 6,746 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 51 | 
コンパイルメッセージ
Syntax OK
ソースコード
require 'set'
require 'rational'
$buf = []
def fill_buf; (s = gets) ? $buf = s.chomp.split : break while $buf.empty? end
def has_next; fill_buf; !$buf.empty? end
def get; fill_buf; $buf.shift end
def geti; get.to_i end
def getf; get.to_f end
def getss(n = nil); n ? Array.new(n) { get } : begin fill_buf; $buf.shift(1e9) end; end
def getis(n = nil); getss(n).map(&:to_i) end
def getfs(n = nil); getss(n).map(&:to_f) end
while has_next
  b1, b2, b3 = getis
  r = Rational(b3 - b2, b2 - b1)
  d = b2 - r*b1
  # p [r, d] w
  p (b3*r + d).to_i
end
            
            
            
        