結果

問題 No.129 お年玉(2)
ユーザー 👑 obakyanobakyan
提出日時 2020-04-11 23:12:38
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 447 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 5,152 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 20:02:15
合計ジャッジ時間 4,066 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,348 KB
testcase_01 AC 128 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 48 ms
4,348 KB
testcase_06 AC 76 ms
4,348 KB
testcase_07 AC 96 ms
4,348 KB
testcase_08 AC 64 ms
4,348 KB
testcase_09 AC 87 ms
4,348 KB
testcase_10 AC 100 ms
4,348 KB
testcase_11 AC 61 ms
4,348 KB
testcase_12 AC 80 ms
4,348 KB
testcase_13 AC 83 ms
4,348 KB
testcase_14 AC 81 ms
4,348 KB
testcase_15 AC 66 ms
4,348 KB
testcase_16 AC 75 ms
4,348 KB
testcase_17 AC 93 ms
4,348 KB
testcase_18 AC 87 ms
4,348 KB
testcase_19 AC 94 ms
4,348 KB
testcase_20 AC 93 ms
4,348 KB
testcase_21 AC 120 ms
4,348 KB
testcase_22 AC 65 ms
4,348 KB
testcase_23 AC 103 ms
4,348 KB
testcase_24 AC 98 ms
4,348 KB
testcase_25 AC 62 ms
4,348 KB
testcase_26 AC 62 ms
4,348 KB
testcase_27 AC 61 ms
4,348 KB
testcase_28 AC 122 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 3 ms
4,348 KB
testcase_38 AC 14 ms
4,348 KB
testcase_39 AC 21 ms
4,348 KB
testcase_40 AC 57 ms
4,348 KB
testcase_41 AC 36 ms
4,348 KB
testcase_42 AC 16 ms
4,348 KB
testcase_43 AC 16 ms
4,348 KB
testcase_44 AC 121 ms
4,348 KB
testcase_45 AC 9 ms
4,348 KB
testcase_46 AC 24 ms
4,348 KB
testcase_47 AC 118 ms
4,348 KB
testcase_48 AC 67 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n = io.read()
if #n <= 3 then
  n = 0
else
  n = n:sub(1, #n - 3)
  n = tonumber(n)
end
local m = io.read("*n")
local mod = 1000000000
n = n % m
local dp1, dp2 = {}, {}
dp1[1] = {1}
for i = 1, m do
  local src = i % 2 == 1 and dp1 or dp2
  local dst = i % 2 == 1 and dp2 or dp1
  dst[1] = 1
  for j = 1, i - 1 do
    dst[j + 1] = (src[j] + src[j + 1]) % mod
  end
  dst[i + 1] = 1
end
local ret = m % 2 == 1 and dp2 or dp1
print(ret[n + 1])
0