-->
当前位置:首页 > 题库

PROGRAMMING:Packing problem

Luz5年前 (2021-05-10)题库457
Suppose there are $$n $$items with the sizes of $$s_ 1$$、$$s_ 2$$、…、$$s_ i$$、…、$$s_ N $$, where $$s_ I $$to satisfy the $$1 / LES_ The integer of I / Le 100 $. These items are to be loaded into a batch of boxes with a capacity of 100 (serial number 1 - $$n $$). The packing method is: for each item, scan the box in sequence, and put the item into the first box enough to hold it. Please write a program to simulate the packing process, and output the box number of each item and the number of boxes needed to place all items.
###Input format:
Enter the first line to give the number of items $$n $$($$$Le 1000 $$); The second line gives $$n $$positive integers $$s_ i$$($$1 \le s_ I / Le 100 $$, indicating the size of item $$I $$).
###Output format:
Output the size of each item and its box serial number according to the input sequence. Each item occupies one line, and the number of boxes required is output in the last line.
###Input example:
```in
eight
60 70 80 90 30 40 10 20
```
###Output example:
```out
60 1
70 2
80 3
90 4
30 1
40 5
10 1
20 2
five
```






answer:If there is no answer, please comment