首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > C# > laquo; Problem description : In a train station, k, k track connected to the sid...

laquo; Problem description : In a train station, k, k track connected to the sid...

  • 资源大小:976.00 B
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: C#

资 源 简 介

« 问题描述:在一个列车调度站中,k条轨道连接到k条侧轨处,形成k个铁路转轨栈,从左到右依次记为H1,H2,…,Hk如下图所示。其中左边轨道为车皮入口(记为H0),右边轨道为出口(记为Hk+1),,编号为a , a , ,an 1 2  的n 个车皮从入口依次进入转轨栈,由调度室安排车皮进出栈次序,并对车皮按其出栈次序重新排序为1,2,…,n。调度室在安排车皮进出栈次序时,遵循以下规则:(1) 车皮入口H0处的车皮可以进入转轨栈H1,H2,…,Hk之一,或直接进入车皮出口Hk+1。(2) 转轨栈H1,H2,…,Hk处的车皮可以进入车皮出口Hk+« 编程任务:给定正整数n,和n个车皮的初始编号n a , a , ,a 1 2  ,编程计算最少需要多少个转轨栈才能按照规则(1)和(2)调度车皮,使车皮在车皮出口按照1,2,…,n的顺序输出。« 数据输入:由文件input.txt 给出输入数据。第1 行有1 个正整数n,表示有n 个车皮。第2 行是n个车皮的初始编号n a , a , ,a 1 2  。« 结果输出:将计算出的最少转轨栈数输出到文件output.txt。输入文件示例 输出文件示例input.txt output.txt42 3 4 13-laquo; Problem description : In a train station, k, k track connected to the side of the tracks, forming k stack rail transition from left to right followed credited to H1, H2, ..., Hk as in the figure below. Which left orbit for imported cars (credited to H0), the right track for exports (credited as a Hk), and numbered a, a, and an 1 2# 61516; The n followed by wagon from the entrance into the stack transition from

文 件 列 表

030300738railk.cpp
VIP VIP
0.184237s