联合开发网   搜索   要求与建议
                登陆    注册
排序按匹配   按投票   按下载次数   按上传日期
按分类查找All 数值算法/人工智能(1) 
按平台查找All Visual Basic(1) 

[数值算法/人工智能] median1363

pku1363,1、题目简介: 给出一个数n,1~n的所有整数会以从小到大的顺序入栈,但出栈顺序不定,同时给出几组出栈的顺序,要求判断给出出栈顺序是否可能。 2、算法实现思想: 首先建立一系列的Stack操作,入push,pop,isEmpty,top,clear等 将要判断的出栈序列存储至一个数组map中。然后从最大的n开始到1进行循环压栈和出栈处理。从出栈序列map[]的尾部开始,进栈,不断寻找最大的出栈,次大的出栈...最后若栈空则为Yes,否则为No
pku1363.The local tradition is that every train arriving from the direction A continues in the direction B with coaches reorganized in some way. Assume that the train arriving from the direction A has N <= 1000 coaches numbered in increasing order 1, 2, ..., N. The chief for train reorganizations must know whether it is possible to marshal coaches continuing in the direction B so that their order will be a1, a2, ..., aN. Help him and write a program that decides whether it is possible to get the required order of coaches. You can assume that single coaches can be disconnected from the train before they enter the station and that they can move themselves until they are on the track in the direction B. You can also suppose that at any time there can be located as many coaches as necessary in the station. But once a coach has entered the station it cannot return to the track in the direction A and also once it has left the station in the direction B it cannot return back to the station (2010-06-29, Visual Basic, 1KB, 下载3次)

http://www.pudn.com/Download/item/id/1226547.html
总计:1