結果

問題 No.781 円周上の格子点の数え上げ
ユーザー 👑 obakyanobakyan
提出日時 2019-04-20 17:23:21
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 133,884 KB
最終ジャッジ日時 2024-04-09 03:17:39
合計ジャッジ時間 4,535 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 154 ms
133,672 KB
testcase_02 AC 160 ms
133,716 KB
testcase_03 WA -
testcase_04 AC 153 ms
133,656 KB
testcase_05 WA -
testcase_06 AC 153 ms
133,752 KB
testcase_07 AC 154 ms
133,604 KB
testcase_08 AC 153 ms
133,768 KB
testcase_09 AC 155 ms
133,752 KB
testcase_10 AC 152 ms
133,716 KB
testcase_11 AC 149 ms
133,540 KB
testcase_12 AC 160 ms
133,748 KB
testcase_13 AC 167 ms
133,676 KB
testcase_14 AC 155 ms
133,716 KB
testcase_15 AC 154 ms
133,568 KB
testcase_16 AC 153 ms
133,652 KB
testcase_17 AC 162 ms
133,648 KB
testcase_18 AC 155 ms
133,656 KB
testcase_19 AC 152 ms
133,676 KB
testcase_20 AC 154 ms
133,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local max = 10000000
local t = {}
for i = 1, max do t[i] = 0 end
local a, b, a2, b2
for a = 0, 3162 do
  a2 = a * a
  b = a
  b2 = b * b
  if(a == 0) then
    b, b2 = 1, 1
  end
  while(a2 + b2 <= max) do
    t[a2 + b2] = t[a2 + b2] + (a2 == b2 and 4 or 8)
    b = b + 1
    b2 = b * b
  end
end
local mma = math.max
local mx = 0
local x, y = io.read("*n", "*n")
for i = x, y do
  mx = mma(t[i], mx)
end
print(mx)
0