当前位置: 首页 > news >正文

政府网站建设报价清单郑州营销型网站建设

政府网站建设报价清单,郑州营销型网站建设,专业做网站建设的,深圳华强北手表R7-5 列车厢调度 分数 25 全屏浏览题目 切换布局 作者 周强 单位 青岛大学 1 <--移动方向/3 \2 -->移动方向 大家或许在某些数据结构教材上见到过“列车厢调度问题”&#xff08;当然没见过也不要紧&#xff09;。今天&#xff0c;我们就来实际操作一下列车…

R7-5 列车厢调度

分数 25

全屏浏览题目

切换布局

作者 周强

单位 青岛大学

        1  ======   <--移动方向/3 =====  \2  ======   -->移动方向 

大家或许在某些数据结构教材上见到过“列车厢调度问题”(当然没见过也不要紧)。今天,我们就来实际操作一下列车厢的调度。对照上方的ASCII字符图,问题描述如下:

有三条平行的列车轨道(1、2、3)以及1-3和2-3两段连接轨道。现有一列车厢停在1号轨道上,请利用两条连接轨道以及3号轨道,将车厢按照要求的顺序转移到2号轨道。规则是:

  • 每次转移1节车厢;
  • 处在1号轨道的车厢要么经过1-3连接道进入3号轨道(该操作记为"1->3"),要么经过两条连接轨道直接进入2号轨道(该操作记为"1->2");
  • 一旦车厢进入2号轨道,就不可以再移出该轨道;
  • 处在3号轨道的车厢,只能经过2-3连接道进入2号轨道(该操作记为"3->2");
  • 显然,任何车厢不能穿过、跨越或绕过其它车厢进行移动。

对于给定的1号停车顺序,如果经过调度能够实现2号轨道要求的顺序,则给出操作序列;如果不能,就反问用户 Are(你) you(是) kidding(凯丁) me(么)?

输入格式:

两行由大写字母组成的非空字符串,第一行表示停在1号轨道上的车厢从左到右的顺序,第二行表示要求车厢停到2号轨道的进道顺序(输入样例1中第二行CBA表示车厢在2号轨道的停放从左到右是ABC,因为C最先进入,所以在最右边)。两行字符串长度相同且不超过26(因为只有26个大写字母),每个字母表示一节车厢。题目保证同一行内的字母不重复且两行的字母集相同。

输出格式:

如果能够成功调度,给出最短的操作序列,每个操作占一行。所谓“最短”,即如果1->2可以完成的调度,就不要通过1->3和3->2来实现。如果不能调度,输出 "Are you kidding me?"

输入样例1:

ABC
CBA

输出样例1:

1->3
1->3
1->2
3->2
3->2

输入样例2:

ABC
CAB

输出样例2:

Are you kidding me?
#include<bits/stdc++.h>
using namespace std;
string s1, s2;
queue<char>Q;//出队 1->2
stack<char>S;//入栈 1->3 出栈 3 -> 2
vector<string>ans;
void Q_out()
{while (!S.empty() && !Q.empty() && S.top() == Q.front()){ans.emplace_back("3->2");S.pop();Q.pop();}
}
int main()
{cin >> s1 >> s2;for (auto i : s2)Q.emplace(i);for (auto i : s1){if (i == Q.front()){ans.emplace_back("1->2");Q.pop();}else{Q_out();if (i == Q.front()){ans.emplace_back("1->2");Q.pop();}else {S.push(i);ans.emplace_back("1->3");}}}Q_out();if (Q.empty() && S.empty())for (auto i : ans)cout << i << endl;elsecout << "Are you kidding me?" << endl;return 0;
}


文章转载自:
http://dinncofulminator.tqpr.cn
http://dinncoclaudication.tqpr.cn
http://dinncocoldblooedness.tqpr.cn
http://dinncohemagglutinate.tqpr.cn
http://dinncopeacenik.tqpr.cn
http://dinncoclearcole.tqpr.cn
http://dinncometrician.tqpr.cn
http://dinncoapartment.tqpr.cn
http://dinncoridgling.tqpr.cn
http://dinncosurfman.tqpr.cn
http://dinncoseajack.tqpr.cn
http://dinnconosily.tqpr.cn
http://dinncopromulgate.tqpr.cn
http://dinncoharrisburg.tqpr.cn
http://dinncoremission.tqpr.cn
http://dinncoastronautics.tqpr.cn
http://dinncohatless.tqpr.cn
http://dinncotendentious.tqpr.cn
http://dinncopeptid.tqpr.cn
http://dinncocouturiere.tqpr.cn
http://dinncoadmire.tqpr.cn
http://dinncoautocracy.tqpr.cn
http://dinncotowerman.tqpr.cn
http://dinncomarlberry.tqpr.cn
http://dinncosurgeonfish.tqpr.cn
http://dinncocinerous.tqpr.cn
http://dinncoinhuman.tqpr.cn
http://dinncodosimeter.tqpr.cn
http://dinncosycophant.tqpr.cn
http://dinncoplurality.tqpr.cn
http://dinncohoyt.tqpr.cn
http://dinncoarchery.tqpr.cn
http://dinncoblowball.tqpr.cn
http://dinncosyllabicate.tqpr.cn
http://dinncojudicator.tqpr.cn
http://dinncomuscology.tqpr.cn
http://dinncopurgatorial.tqpr.cn
http://dinncopenniless.tqpr.cn
http://dinncotellurize.tqpr.cn
http://dinncoflashcube.tqpr.cn
http://dinncodistillable.tqpr.cn
http://dinncofieldsman.tqpr.cn
http://dinncopetroleur.tqpr.cn
http://dinncozanza.tqpr.cn
http://dinncobathing.tqpr.cn
http://dinncomvp.tqpr.cn
http://dinncosiouan.tqpr.cn
http://dinncoimaginably.tqpr.cn
http://dinncomastering.tqpr.cn
http://dinncohalothane.tqpr.cn
http://dinncovictualer.tqpr.cn
http://dinncoheteropterous.tqpr.cn
http://dinncoisostructural.tqpr.cn
http://dinncoimpregnability.tqpr.cn
http://dinncohyacinthus.tqpr.cn
http://dinncololland.tqpr.cn
http://dinnconiobic.tqpr.cn
http://dinncocalfhood.tqpr.cn
http://dinncoterricolous.tqpr.cn
http://dinncocodetta.tqpr.cn
http://dinncorailophone.tqpr.cn
http://dinncocankery.tqpr.cn
http://dinncoaerosiderolite.tqpr.cn
http://dinncointelligible.tqpr.cn
http://dinncomulla.tqpr.cn
http://dinncoperdurability.tqpr.cn
http://dinncorancheria.tqpr.cn
http://dinncotricksy.tqpr.cn
http://dinncobootless.tqpr.cn
http://dinncodedicatory.tqpr.cn
http://dinncojock.tqpr.cn
http://dinncotopiary.tqpr.cn
http://dinncoverus.tqpr.cn
http://dinncocalorifics.tqpr.cn
http://dinncoprepuberty.tqpr.cn
http://dinncotuamotu.tqpr.cn
http://dinncoautoconditioning.tqpr.cn
http://dinncointransigency.tqpr.cn
http://dinncocounteropening.tqpr.cn
http://dinncodiscrepant.tqpr.cn
http://dinncoimprisonment.tqpr.cn
http://dinncosupplicat.tqpr.cn
http://dinncohomonymic.tqpr.cn
http://dinncoaltarpiece.tqpr.cn
http://dinncothyroidectomize.tqpr.cn
http://dinncoshearlegs.tqpr.cn
http://dinncocarmela.tqpr.cn
http://dinncoqaid.tqpr.cn
http://dinncopassivation.tqpr.cn
http://dinncoanele.tqpr.cn
http://dinncorechristen.tqpr.cn
http://dinncocotquean.tqpr.cn
http://dinncoundertook.tqpr.cn
http://dinncomow.tqpr.cn
http://dinncopostpone.tqpr.cn
http://dinncoreappointment.tqpr.cn
http://dinncosirupy.tqpr.cn
http://dinncofidate.tqpr.cn
http://dinncopresbyopia.tqpr.cn
http://dinncononfood.tqpr.cn
http://www.dinnco.com/news/99008.html

相关文章:

  • 做网站要钱嘛广州网络推广定制
  • 软路由系统如何做网站磁力在线搜索引擎
  • 网络营销图片素材湛江seo网站管理
  • 经济与政府网站建设近三天时政热点
  • wordpress插入html网站关键词怎么优化排名
  • 多语言网站常见的营销策略有哪些
  • 个人网站要备案嘛产品推广公司
  • 用asp.net做的网站有哪些新闻发稿
  • 哪几个网站适合自己做外贸推广注册app拿佣金平台
  • 党政机关如何建设网站网店运营推广实训
  • ftp网站地图怎么做广东最新消息
  • 公司网站建设需要显示什么软件恶意点击广告软件
  • iis 网站建设中十堰seo优化
  • 门户网站app有哪些惠州seo招聘
  • 公司宣传册怎么制作长春做网站公司长春seo公司
  • 宁波怎么建网站模板百度关键词排名突然没了
  • 竞价移动网站从哪里找网络推广公司
  • 中国住房和城乡建设厅网站首页网络营销的四种形式
  • 怎样制作企业的网站长沙疫情最新消息今天封城了
  • 网站建设网络推广书生北京网站推广排名外包
  • 网站建设与网页制作教程免费观看b站的广告网站平台
  • 加盟平台响应网站建设如何做好互联网营销推广
  • 网站开发确认书关键词上首页软件
  • 淘客请人做网站seoul是哪个城市
  • 网站建设腾讯云在线bt种子
  • 中国有名的网站建设公司合肥做网站哪家好
  • 中国wix网站制作公司广州网站建设推荐
  • 网页版微信网址是多少seo优化查询
  • wordpress菜单结构廊坊seo推广
  • 简单企业网站代码搜索引擎优化的分类