結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ゆうなんとか
提出日時 2019-01-18 01:11:10
言語 Ruby
(3.4.1)
結果
RE  
実行時間 -
コード長 245 bytes
コンパイル時間 37 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-07-01 10:13:56
合計ジャッジ時間 11,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 RE * 3 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

x, y = gets.strip.split.map(&:to_i)
ans = Array.new(10_000_000, 0)
sqrt = Integer.sqrt y
for i in 1..sqrt
    a = i * i
    for j in 0..sqrt
        b = j * j
        break if a + b > y
        ans[a + b] += 1
    end
end

puts ans[x..y].max * 4
0