此问题需要程序 [英] NEED PROGRAM FOR THIS QUES

查看:44
本文介绍了此问题需要程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一家大理石店里,准备了几包大理石.数据包被命名为A,B,C,D,E……..所有数据包均以随机顺序保存在VERTICAL SHELF中.可以将任何数量的具有这些名称的数据包保留在该机架中,如本例所示: [AAAJKRDFDEWAAYFYYKK] -----架子的顶部.所有这些数据包都将被装载到汽车上.轿厢按顺序排列,以便可以将小包装载到它们上.这些汽车也被命名为[A,B,C,D,E,………….].每辆汽车将使用相同的字母加载数据包.因此,例如,汽车"A"将加载名称为"A"的所有数据包.每辆特定的汽车只能在装载点到达一次.这些汽车将按字母顺序到达装载点.因此,汽车"B"会来,并从架子上取下所有名称为"B"的数据包,然后汽车"C"会来.无论架子"B"在架子上有多深,所有"B"包都将在"C"车到达之前被移位.为此,提供了一些额外的架子.在小包B之后的小包被保存在那些架子中.这些架子中的任何一个仅包含具有相同名称的小包.例如,如果使用任何特定的架子,并且其中有名称为X的数据包,则仅将名称为X的数据包保留在其中.该架子看起来像[XXXXXXX].如果有一个架子被使用过一次,那么只有在空着的时候才可以再次使用它.最初架子上的数据包只能从顶部卸下.编写一个程序,查找最少的架子总数,包括该装载过程所需的初始架子.

解决方案

它看起来很有趣,但是仍然是您的作业,因此开始编码并在此处发布特定问题.


t a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with these names could be kept in that shelf as in this example: bottom of shelf ---> [AAAJKRDFDEWAAYFYYKK]-----Top of shelf. All these packets are to be loaded on cars. The cars are lined in order, so that the packet could be loaded on them. The cars are also named [A, B, C, D, E,………….]. Each Car will load the packet with the same alphabet. So, for example, car ‘A’ will load all the packets with name ‘A’. Each particular car will come at the loading point only once. The cars will come at the loading point in alphabetical order. So, car ‘B’ will come and take all the packets with name ‘B’ from the shelf, then car ‘C’ will come. No matter how deep in the shelf any packet ‘B’ is, all of the ‘B’ packets will be displaced before the ‘C’ car arrives. For that purpose, some additional shelves are provided. The packets which are after the packet B, are kept in those shelves. Any one of these shelves contains only packets, having the same name. For example, if any particular shelf is used and if a packet with name X is in it, then only the packets having names X will be kept in it. That shelf will look like [XXXXXXX]. If any shelf is used once, then it could be used again only if it is vacant. Packets from the initial shelf could be unloaded from top only. Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

解决方案

It looks interesting, however it still is your homework, so start coding and post just specific questions here.


这篇关于此问题需要程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆