結果

問題 No.202 1円玉投げ
ユーザー TANIGUCHI Kousuke
提出日時 2015-08-19 12:41:06
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 416 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 40,832 KB
最終ジャッジ日時 2024-12-22 09:54:32
合計ジャッジ時間 38,463 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 4 RE * 22 TLE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# Here your code !
def d2(a,b)
    2.times.inject(0) do |s, i|
        s + (a[i] - b[i]) ** 2
    end
end

n = gets.to_i
coins = n.times.map {gets.split.map(&:to_i)}
areas = 100.times.map { Array.new(100) }

s = coins.inject(0) {|s,c|
    i,j = c.map {|v| v.div 200}
    areas[i][j] ||= []
    if areas[i][j].all? {|put| d2(put,c) >= 400}
        areas[i][j].push(c)
        s+1
    else
        s
    end
}

puts s
0