結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2018-03-09 22:26:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-11-18 12:09:12 |
合計ジャッジ時間 | 1,956 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
# 参考 # yukicoder # No.5 数字のブロック # https://yukicoder.me/problems/no/5 def block_numbers(l, n, w): # int() で文字列を数値に変える box_width = int(l) block_num = int(n) # list(map(int, hoge)) でリスト内の型を変換する block_width = list(map(int, w.split(sep=" "))) total = 0 input_count = 0 for value in sorted(block_width): if box_width >= total + value: # i++ というインクリメントは使用できない input_count += 1 total += value else: break return input_count def main(): input_l = input() input_n = input() input_w = input() print(block_numbers(input_l, input_n, input_w)) if __name__ == '__main__': main()