結果

問題 No.781 円周上の格子点の数え上げ
ユーザー ゆうなんとかゆうなんとか
提出日時 2019-01-18 01:11:10
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 245 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 11,560 KB
実行使用メモリ 93,652 KB
最終ジャッジ日時 2023-09-14 02:08:39
合計ジャッジ時間 8,775 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
93,292 KB
testcase_01 AC 117 ms
93,228 KB
testcase_02 AC 116 ms
93,424 KB
testcase_03 AC 116 ms
93,320 KB
testcase_04 AC 116 ms
93,484 KB
testcase_05 AC 119 ms
93,228 KB
testcase_06 AC 124 ms
93,196 KB
testcase_07 AC 128 ms
93,240 KB
testcase_08 RE -
testcase_09 AC 1,581 ms
93,196 KB
testcase_10 AC 116 ms
93,184 KB
testcase_11 AC 120 ms
93,188 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 188 ms
93,336 KB
testcase_15 AC 120 ms
93,300 KB
testcase_16 AC 117 ms
93,408 KB
testcase_17 AC 946 ms
93,188 KB
testcase_18 AC 957 ms
93,224 KB
testcase_19 AC 967 ms
93,424 KB
testcase_20 AC 976 ms
93,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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