トラック
解き方
私の解き方
問題の収穫
知るところ
dict()関数
dict()関数のパラメータ変数はdicksherner(ハッシュ)型に変換されます.
weight += int(dict_specs.get(name))
get()関数でディクシャナ型変数のキー値の値を返します.
改善すべき点
私たちはPythonでハッシュ問題を解決する方法を学ぶべきだと思います.
ソース
https://school.programmers.co.kr/courses/13093/lessons/88768
私の解き方
def solution(max_weight, specs, names):
dict_specs = dict(specs)
count = 1
weight = 0
for name in names:
weight += int(dict_specs.get(name))
if max_weight < weight:
count += 1
weight = int(dict_specs.get(name))
return count
sol1問題の収穫
知るところ
dict()関数
dict()関数のパラメータ変数はdicksherner(ハッシュ)型に変換されます.
weight += int(dict_specs.get(name))
get()関数でディクシャナ型変数のキー値の値を返します.
改善すべき点
私たちはPythonでハッシュ問題を解決する方法を学ぶべきだと思います.
ソース
https://school.programmers.co.kr/courses/13093/lessons/88768
Reference
この問題について(トラック), 我々は、より多くの情報をここで見つけました https://velog.io/@dogit/운송트럭テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol