結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kl_tomasonkl_tomason
提出日時 2019-01-12 08:01:12
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 277 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 11,552 KB
実行使用メモリ 93,716 KB
最終ジャッジ日時 2023-08-22 07:57:07
合計ジャッジ時間 10,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
22,140 KB
testcase_01 WA -
testcase_02 AC 82 ms
15,036 KB
testcase_03 AC 82 ms
15,156 KB
testcase_04 WA -
testcase_05 AC 82 ms
15,128 KB
testcase_06 AC 93 ms
15,244 KB
testcase_07 AC 109 ms
15,020 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 AC 90 ms
15,412 KB
testcase_11 AC 103 ms
15,728 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

X, Y = gets.split.map &:to_i

h = Hash.new(0)

ans = 0

for y in 0..Math.sqrt(Y) do
    for x in 0..(Math.sqrt(Y) - 1) do
        rr = y**2 + x**2
        if X <= rr && rr <= Y then
            h[rr] += 1
            ans = [ans, h[rr]].max 
        end
    end
end

puts ans*4
0