結果

問題 No.1791 Repeat Multiplication
ユーザー 👑 obakyanobakyan
提出日時 2022-10-01 13:48:59
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 226 ms / 3,000 ms
コード長 374 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 5,304 KB
実行使用メモリ 36,144 KB
最終ジャッジ日時 2023-08-25 11:41:47
合計ジャッジ時間 8,642 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 69 ms
4,376 KB
testcase_09 AC 63 ms
4,380 KB
testcase_10 AC 63 ms
4,376 KB
testcase_11 AC 57 ms
4,384 KB
testcase_12 AC 34 ms
4,380 KB
testcase_13 AC 214 ms
34,836 KB
testcase_14 AC 209 ms
35,036 KB
testcase_15 AC 154 ms
18,460 KB
testcase_16 AC 153 ms
18,536 KB
testcase_17 AC 208 ms
34,984 KB
testcase_18 AC 187 ms
34,792 KB
testcase_19 AC 197 ms
35,052 KB
testcase_20 AC 170 ms
35,124 KB
testcase_21 AC 182 ms
35,028 KB
testcase_22 AC 216 ms
34,992 KB
testcase_23 AC 184 ms
34,916 KB
testcase_24 AC 213 ms
34,944 KB
testcase_25 AC 183 ms
34,948 KB
testcase_26 AC 192 ms
35,148 KB
testcase_27 AC 179 ms
34,824 KB
testcase_28 AC 215 ms
36,144 KB
testcase_29 AC 226 ms
35,156 KB
testcase_30 AC 197 ms
35,440 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 195 ms
35,004 KB
testcase_33 AC 214 ms
35,168 KB
testcase_34 AC 205 ms
34,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local mfl, mce = math.floor, math.ceil
local n, q = io.read("*n", "*n")
local t = {1}
for i = 2, n do
  t[i] = 0
end
for i = 1, n do
  local lim = mfl(n / i)
  for j = 2, lim do
    t[i * j] = t[i * j] + t[i]
  end
end
local sum = {t[1]}
for i = 2, n do
  sum[i] = sum[i - 1] + t[i]
end

for iq = 1, q do
  local x = io.read("*n")
  print(t[x] * sum[math.floor(n / x)])
end
0