結果

問題 No.634 硬貨の枚数1
ユーザー Coki628Coki628
提出日時 2020-09-03 18:23:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 927 bytes
コンパイル時間 495 ms
コンパイル使用メモリ 87,668 KB
実行使用メモリ 117,092 KB
最終ジャッジ日時 2023-08-15 13:05:48
合計ジャッジ時間 5,827 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
76,264 KB
testcase_01 AC 61 ms
71,516 KB
testcase_02 AC 108 ms
77,456 KB
testcase_03 AC 85 ms
76,728 KB
testcase_04 AC 83 ms
76,708 KB
testcase_05 AC 75 ms
76,544 KB
testcase_06 AC 91 ms
76,556 KB
testcase_07 AC 80 ms
76,472 KB
testcase_08 AC 71 ms
76,560 KB
testcase_09 AC 91 ms
77,352 KB
testcase_10 AC 82 ms
76,576 KB
testcase_11 AC 78 ms
76,468 KB
testcase_12 AC 87 ms
76,572 KB
testcase_13 AC 76 ms
76,512 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()

A = [0]
for i in range(1, N+1):
    A.append(A[-1]+i)
    if A[-1] > N:
        break

M = len(A)
dp = [INF] * (N+1)
dp[0] = 0
for i in range(N):
    for a in A[1:]:
        if i+a <= N:
            dp[i+a] = min(dp[i+a], dp[i] + 1)
ans = dp[N]
print(ans)
0