結果
問題 | No.634 硬貨の枚数1 |
ユーザー | 👑 obakyan |
提出日時 | 2019-06-04 22:47:29 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 753 ms / 2,000 ms |
コード長 | 710 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 7,072 KB |
実行使用メモリ | 133,880 KB |
最終ジャッジ日時 | 2024-09-17 20:54:39 |
合計ジャッジ時間 | 22,615 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
133,752 KB |
testcase_01 | AC | 67 ms
133,760 KB |
testcase_02 | AC | 66 ms
133,760 KB |
testcase_03 | AC | 67 ms
133,760 KB |
testcase_04 | AC | 67 ms
133,760 KB |
testcase_05 | AC | 70 ms
133,744 KB |
testcase_06 | AC | 66 ms
133,760 KB |
testcase_07 | AC | 66 ms
133,680 KB |
testcase_08 | AC | 67 ms
133,760 KB |
testcase_09 | AC | 66 ms
133,744 KB |
testcase_10 | AC | 67 ms
133,684 KB |
testcase_11 | AC | 67 ms
133,824 KB |
testcase_12 | AC | 67 ms
133,760 KB |
testcase_13 | AC | 67 ms
133,760 KB |
testcase_14 | AC | 112 ms
133,684 KB |
testcase_15 | AC | 636 ms
133,864 KB |
testcase_16 | AC | 215 ms
133,880 KB |
testcase_17 | AC | 337 ms
133,760 KB |
testcase_18 | AC | 273 ms
133,760 KB |
testcase_19 | AC | 68 ms
133,760 KB |
testcase_20 | AC | 69 ms
133,760 KB |
testcase_21 | AC | 440 ms
133,760 KB |
testcase_22 | AC | 611 ms
133,748 KB |
testcase_23 | AC | 207 ms
133,760 KB |
testcase_24 | AC | 70 ms
133,760 KB |
testcase_25 | AC | 69 ms
133,632 KB |
testcase_26 | AC | 69 ms
133,760 KB |
testcase_27 | AC | 68 ms
133,632 KB |
testcase_28 | AC | 69 ms
133,836 KB |
testcase_29 | AC | 67 ms
133,760 KB |
testcase_30 | AC | 69 ms
133,760 KB |
testcase_31 | AC | 70 ms
133,632 KB |
testcase_32 | AC | 67 ms
133,760 KB |
testcase_33 | AC | 67 ms
133,760 KB |
testcase_34 | AC | 90 ms
133,748 KB |
testcase_35 | AC | 217 ms
133,760 KB |
testcase_36 | AC | 293 ms
133,800 KB |
testcase_37 | AC | 230 ms
133,632 KB |
testcase_38 | AC | 103 ms
133,760 KB |
testcase_39 | AC | 380 ms
133,632 KB |
testcase_40 | AC | 295 ms
133,716 KB |
testcase_41 | AC | 383 ms
133,760 KB |
testcase_42 | AC | 360 ms
133,760 KB |
testcase_43 | AC | 199 ms
133,760 KB |
testcase_44 | AC | 68 ms
133,632 KB |
testcase_45 | AC | 71 ms
133,760 KB |
testcase_46 | AC | 71 ms
133,760 KB |
testcase_47 | AC | 86 ms
133,760 KB |
testcase_48 | AC | 66 ms
133,760 KB |
testcase_49 | AC | 67 ms
133,760 KB |
testcase_50 | AC | 452 ms
133,760 KB |
testcase_51 | AC | 106 ms
133,876 KB |
testcase_52 | AC | 66 ms
133,760 KB |
testcase_53 | AC | 67 ms
133,632 KB |
testcase_54 | AC | 67 ms
133,752 KB |
testcase_55 | AC | 753 ms
133,760 KB |
testcase_56 | AC | 745 ms
133,852 KB |
testcase_57 | AC | 708 ms
133,712 KB |
testcase_58 | AC | 440 ms
133,760 KB |
testcase_59 | AC | 454 ms
133,832 KB |
testcase_60 | AC | 437 ms
133,760 KB |
testcase_61 | AC | 445 ms
133,684 KB |
testcase_62 | AC | 435 ms
133,760 KB |
testcase_63 | AC | 715 ms
133,760 KB |
testcase_64 | AC | 448 ms
133,748 KB |
testcase_65 | AC | 441 ms
133,760 KB |
testcase_66 | AC | 731 ms
133,744 KB |
testcase_67 | AC | 446 ms
133,632 KB |
testcase_68 | AC | 709 ms
133,760 KB |
testcase_69 | AC | 703 ms
133,740 KB |
testcase_70 | AC | 464 ms
133,760 KB |
testcase_71 | AC | 453 ms
133,632 KB |
testcase_72 | AC | 715 ms
133,748 KB |
testcase_73 | AC | 452 ms
133,648 KB |
testcase_74 | AC | 703 ms
133,844 KB |
testcase_75 | AC | 693 ms
133,632 KB |
testcase_76 | AC | 70 ms
133,748 KB |
testcase_77 | AC | 68 ms
133,632 KB |
ソースコード
local mfl = math.floor local n = io.read("*n") local t = {} local max = 4471 local v = {} local inf = n + 1 for i = 1, max do v[i] = mfl(i * (i + 1) / 2) end for i = 1, 10000000 do t[i] = inf end local f = false for i = 1, max do if n == v[i] then t[n] = 1 f = true break elseif v[i] < n then t[v[i]] = 1 end end local mmi = math.min while not f do for i = n - 1, 1, -1 do if t[i] ~= inf then for i_v = 1, max do local dst = i + v[i_v] if dst == n then f = true t[n] = t[i] + 1 break elseif dst < n then t[dst] = mmi(t[i] + 1, t[dst]) end end end if f then break end end end print(t[n])