b605. Package
標籤 :
通過比率 : 161人/178人 ( 90% ) [非即時]
評分方式:
Tolerant

最近更新 : 2015-10-14 09:11

內容

A store sells seven kinds of products. All products' height are the same, and each product's length is equal to it's width. The seven kinds of products' length are: 1, 2, 4, 8, 16, 32, 64. Suppose a man bought some products and he wants to pack all the things he bought in only one box. He may buy the same products more than one. The box's height is equal to all products', and the box's length is equal to it's width. A bigger box costs more than a smaller one! Your task is to write a program to help the man to find the minimum length of the box he needs.

輸入說明

Each input contains one line which has seven integers. Each integer denotes the number of the same kind products that the man bought. The first integer is the number of all products whose length are 1; the second is the number of all products whose length are 2; the third is the number of all products whose length are 4; . . .; the seventh is the number of all products whose length are 64. Each input value is between 0 and 5000. The last line of inputs is only one -1 indicating the end of inputs.

輸出說明

For each input data, print out the minimum length of the box that the man could use it to pack all the products.

範例輸入 #1
1 0 0 0 0 0 0
1 1 1 1 0 0 0
0 0 0 0 20 0 1
0 0 0 1 20 0 1
-1
範例輸出 #1
1
12
96
104
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (100%): 2.0s , <1K
提示 :
標籤:
出處:
[管理者: spocktsai (囧rz) ]

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
22938 snakeneedy (蛇~Snake) b605
中文題意說明
1298 2020-10-12 00:51
19370 es611543 (afa) b605
解法思路
1228 2019-09-28 16:42