Strict Standards: Non-static method HTML_content::Title() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 470
B1. Đóng gói sản phẩm
Strict Standards: Non-static method HTML_content::EditIcon() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 632
|
Strict Standards: Non-static method HTML_content::PdfIcon() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 473
Strict Standards: Non-static method mosHTML::PrintIcon() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 476
Strict Standards: Non-static method mosAdminMenus::ImageCheck() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/includes/joomla.php on line 2329
Strict Standards: Non-static method HTML_content::EmailIcon() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 479
Strict Standards: Non-static method HTML_content::Section_Category() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 511
Strict Standards: Non-static method HTML_content::Section() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 755
Strict Standards: Non-static method HTML_content::Category() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 758
Strict Standards: Non-static method HTML_content::Author() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 514
Người viết: Ngô Minh Đức
|
Strict Standards: Non-static method HTML_content::CreateDate() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 517
20/06/2008 |
Strict Standards: Non-static method HTML_content::URL() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 520
Strict Standards: Non-static method HTML_content::TOC() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 526
Bài
1. Đóng gói sản phẩm
Tên file chương trình: ZXY.PAS
Ở đầu ra của
một dây chuyền sản xuất trong nhà máy ZXY có một máy xếp tự động. Sau khi kết
thúc việc gia công trên dây chuyền, các sản phẩm sẽ được xếp vào các hộp có
cùng dung lượng M.
Sản phẩm rời khỏi dây chuyền được xếp vào hộp đang mở
(khi bắt đầu ca làm việc có một hộp rỗng được mở sẵn) nếu như dung lượng của
hộp còn đủ để chứa sản phẩm. Trong trường hợp ngược lại, máy sẽ tự động đóng nắp hộp hiện tại, cho xuất
xưởng rồi mở một hộp rỗng mới để xếp sản phẩm vào. Trong một ca làm việc có n sản phẩm đánh số từ 1 đến n theo đúng thứ tự mà chúng rời khỏi dây
chuyền. Sản phẩm thứ i có trọng lượng
là ai, i = 1, 2, …, n. Ban Giám đốc nhà máy qui định rằng
sản phẩm xuất xưởng của mỗi ca làm việc phải được xếp vào trong không quá k hộp.
Yêu cầu: Hãy giúp người quản đốc
của ca làm việc xác định giá trị M nhỏ nhất sao cho số hộp mà máy tự động
cần sử dụng để xếp dãy n sản phẩm
xuất xưởng của ca không vượt quá số k cho trước.
Dữ liệu: Vào từ file văn bản ZXY.INP:
·
Dòng đầu tiên chứa hai số nguyên n và k,
(1≤ k ≤ n ≤ 15000);
·
Dòng thứ i
trong n dòng tiếp theo chứa số nguyên
dương ai (ai ≤30000), i =1, 2, …, n.
Các số trên một dòng
cách nhau ít nhất một dấu cách.
Kết quả: Ghi ra file ZXY.OUT một
số nguyên duy nhất là dung lượng của hộp.
Ví dụ:
ZXY.INP
|
|
ZXY.OUT
|
9 4
1
1
3
2
2
1
3
1
|
|
5
|
|
Strict Standards: Non-static method HTML_content::ModifiedDate() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 536
Strict Standards: Non-static method HTML_content::ReadMore() should not be called statically in /home/vmapps4u/public_html/vnoi_v0/components/com_content/content.html.php on line 539