結果

問題 No.27 板の準備
ユーザー zimphazimpha
提出日時 2017-12-11 23:11:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 401 ms / 5,000 ms
コード長 356 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 7,980 KB
最終ジャッジ日時 2023-08-27 04:49:02
合計ジャッジ時間 6,179 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
7,844 KB
testcase_01 AC 78 ms
7,964 KB
testcase_02 AC 381 ms
7,912 KB
testcase_03 AC 95 ms
7,812 KB
testcase_04 AC 285 ms
7,768 KB
testcase_05 AC 220 ms
7,884 KB
testcase_06 AC 301 ms
7,848 KB
testcase_07 AC 377 ms
7,848 KB
testcase_08 AC 397 ms
7,980 KB
testcase_09 AC 379 ms
7,820 KB
testcase_10 AC 359 ms
7,764 KB
testcase_11 AC 251 ms
7,764 KB
testcase_12 AC 302 ms
7,836 KB
testcase_13 AC 286 ms
7,832 KB
testcase_14 AC 236 ms
7,820 KB
testcase_15 AC 362 ms
7,916 KB
testcase_16 AC 129 ms
7,800 KB
testcase_17 AC 401 ms
7,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def count(a, b):
  n = max(b)
  dp = [1e9] * (n + 1)
  dp[0] = 0
  for x in a:
    for i in range(x, n + 1):
      dp[i] = min(dp[i], dp[i - x] + 1)
  return sum([dp[x] for x in b])

v = list(map(int, input().split()))
ret = 1e9
for x in range(1, 31):
  for y in range(1, 31):
    for z in range(1, 31):
      ret = min(ret, count([x, y, z], v))
print(ret)
0