結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kl_tomasonkl_tomason
提出日時 2019-01-12 08:04:21
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 283 bytes
コンパイル時間 127 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 104,592 KB
最終ジャッジ日時 2023-08-22 08:01:31
合計ジャッジ時間 8,078 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
104,592 KB
testcase_01 AC 78 ms
15,152 KB
testcase_02 AC 78 ms
15,308 KB
testcase_03 AC 80 ms
15,180 KB
testcase_04 AC 80 ms
15,044 KB
testcase_05 AC 79 ms
15,144 KB
testcase_06 AC 87 ms
15,176 KB
testcase_07 AC 97 ms
15,040 KB
testcase_08 AC 1,558 ms
15,168 KB
testcase_09 AC 1,558 ms
15,152 KB
testcase_10 AC 83 ms
15,560 KB
testcase_11 AC 92 ms
15,996 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 1..Math.sqrt(Y).floor do
    for x in 0..Math.sqrt(Y).floor 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