POJ 1041问题描述
Description
The streets in Johnny's town were named by integer numbers from 1 to n, n < 1995. The junctions were independently named by integer numbers from 1 to m, m <= 44. No junction connects more than 44 streets. All junctions in the town had different numbers. Each street was connecting exactly two junctions. No two streets in the town had the same number. He immediately started to plan his round trip. If there was more than one such round trip, he would have chosen the one which, when written down as a sequence of street numbers is lexicographically the smallest. But Johnny was not able to find even one such round trip.
Help Johnny and write a program which finds the desired shortest round trip. If the round trip does not exist the program should write a message. Assume that Johnny lives at the junction ending the street appears first in the input with smaller number. All streets in the town are two way. There exists a way from each street to another street in the town. The streets in the town are very narrow and there is no possibility to turn back the car once he is in the street
Input
Output
Sample Input
1 2 1
2 3 2
3 1 6
1 2 5
2 3 3
3 1 4
0 0
1 2 1
2 3 2
1 3 3
2 4 4
0 0
0 0
Sample Output
1 2 3 5 4 6
Round trip does not exist.
POJ 1041问题描述的更多相关文章
- poj 1041(欧拉回路+输出字典序最小路径)
题目链接:http://poj.org/problem?id=1041 思路:懒得写了,直接copy吧:对于一个图可以从一个顶点沿着边走下去,每个边只走一次,所有的边都经过后回到原点的路.一个无向图存 ...
- [POJ 1041] John's Trip
[题目链接] http://poj.org/problem?id=1041 [算法] 欧拉回路[代码] #include <algorithm> #include <bitset&g ...
- poj 1041 John's trip——欧拉回路字典序输出
题目:http://poj.org/problem?id=1041 明明是欧拉回路字典序输出的模板. 优先队列存边有毒.写跪.学习学习TJ发现只要按边权从大到小排序连边就能正常用邻接表了! 还有一种存 ...
- POJ 1528问题描述
Description From the article Number Theory in the 1994 Microsoft Encarta: ``If a, b, c are integers ...
- POJ 1039问题描述
Description The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic li ...
- POJ 1035题目描述
Description You, as a member of a development team for a new spell checking program, are to write a ...
- POJ 1032问题描述
Description New convocation of The Fool Land's Parliament consists of N delegates. According to the ...
- POJ 1028题目描述
Description Standard web browsers contain features to move backward and forward among the pages rece ...
- poj 1041 John's trip 欧拉回路
题目链接 求给出的图是否存在欧拉回路并输出路径, 从1这个点开始, 输出时按边的升序输出. 将每个点的边排序一下就可以. #include <iostream> #include < ...
随机推荐
- QRadioButton 使用方法
QRadioButton 控件是Qt中实现多选一功能的控件,它的使用方法如下: 声明控件: QRadioButton *rbutton; 然后实现它的响应函数: void YourClass::on_ ...
- oracle在线重定义表
在一个高可用系统中,如果需要改变一个表的定义是一件比较棘手的问题,尤其是对于7×24系统.Oracle提供的基本语法基本可以满足一般性修改,但是对于把普通堆表改为分区表,把索引组织表修改为堆表等操作就 ...
- phpunit安装参考
我主要参考看PHPunit参考手册https://phpunit.de/manual/current/zh_cn/installation.html 然后按照测试成功否检验,参考了http://blo ...
- 分布式架构高可用架构篇_02_activemq高可用集群(zookeeper+leveldb)安装、配置、高可用测试
参考: 龙果学院http://www.roncoo.com/share.html?hamc=hLPG8QsaaWVOl2Z76wpJHp3JBbZZF%2Bywm5vEfPp9LbLkAjAnB%2B ...
- CKEditor的使用-编辑文本
官网下载以及演示:http://ckeditor.com/ 引入js <script src="/Example6/ckeditor/ckeditor.js">< ...
- Java表单类双击提交
双击制御 有些时候一些操作会非常的耗费时间(Long Lived Operation),例如这个数据库的导出,表表生成等.有些时候程序的使用者看到很长时间服务器 没有反应,倾向于多次点击提交按钮.这样 ...
- 移动Web应用开发入门指南——视觉篇
视觉篇 智能移动设备由于发展历史短,但更新速度快,从而导致移动设备的物理属性差异巨大,其中一部分物理属性影响视觉,另一部分影响到交互.兼容或性能.对人类来说,至少有80%以上的外界信息通过视觉获得,视 ...
- StringUtils cannot be resolved
I am using Java server pages and for using String Manipulations and i am Using StringUtils which i a ...
- 小红伞和virtualbox5.0.10冲突
win7 sp1 64bit 旗舰版:virtual box 5.0.10 提示 error in supr3hardNtChildWaitFor……Timed out after 60001 ms ...
- UIbutton 和UIview 切单角
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.backgroundColor = [UIColor cya ...