POJ 2491
#include<iostream>
#include<stdio.h>
#include<string>
#define MAXN 400
using namespace std;
struct node
{
string s1;
string s2;
};
node a[400];
int main()
{
//freopen("acm.acm","r",stdin);
int test;
int num;
int i;
int j;
int k;
int r;
cin>>test;
for(k = 0; k < test; ++ k)
{
cin>>num;
for(i = 0; i < num-1; ++ i)
{
cin>>a[i].s1;
cin>>a[i].s2;
}
for(i = 0; i < num-1; ++ i)
{
for(j = 0; j < num-1; ++ j)
{
if(a[i].s1 == a[j].s2)
{
break;
}
}
if(j == num-1)
{
cout<<"Scenario #"<<k+1<<":"<<endl;
cout<<a[i].s1<<endl;
cout<<a[i].s2<<endl;
for(j = 0; j < num-2; ++ j)
{
for(r = 0; r < num-1; ++ r)
{
if(a[i].s2 == a[r].s1)
{
cout<<a[r].s2<<endl;
a[i].s2 = a[r].s2;
break;
}
}
}
break;
}
}
cout<<endl;
}
}
POJ 2491的更多相关文章
- POJ 2491 Scavenger Hunt map
Scavenger Hunt Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2848 Accepted: 1553 De ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
- POJ 2739. Sum of Consecutive Prime Numbers
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20050 ...
- POJ 2255. Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11939 Accepted: 7493 De ...
- POJ 2752 Seek the Name, Seek the Fame [kmp]
Seek the Name, Seek the Fame Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17898 Ac ...
随机推荐
- 集成 dubbo 微服务
微服务架构近年来非常的火,阿里 的dubbo 是其中的一种解决方案. dubbo 的微服务主要分为以下几部分: 1.注册中心 2.服务提供者 3.消费者 4.监控平台 1.一般流程服务提供者向注册中心 ...
- (18)What a planet needs to sustain life
https://www.ted.com/talks/dave_brain_what_a_planet_needs_to_sustain_life/transcript 00:12I'm really ...
- poj 2240 Arbitrage(最短路问题)
Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit o ...
- Atcoder Grand-014 Writeup
A - Cookie Exchanges 题面 Takahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respec ...
- ArcGIS 关于Web_Mercator
#小知识#EPSG,即 European Petroleum Standards Group 欧洲石油标准组织 在ArcGIS 10中Web Mercator有三种EPSG编号.他们分别是EPSG38 ...
- WordPaster-UEditor1.x整合教程
版权所有 2009-2017 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/ 产品首页:http://www.ncmem.com/webplug/wordpa ...
- 整理mianshi
对象锁和类锁wait sleepAMSactivity启动流程handler消息机制JNI相关 1.looper.prepare()做了啥操作https://www.cnblogs.com/ganch ...
- virtualbox centos 连接网络
一.设置网络 设置 -> 网络 -> 连接方式:桥接网卡.设置当前连网络的界面名称.接入网线打勾 二.开启eth0 vi /etc/sysconfig/network-scripts/if ...
- _编程语言_C语言_C++_时间
C++ 标准库没有提供日期类型,使用C预压的日期和事件操作. 使用时引入头文件 <ctime> . 四个和事件相关的函数: clock_t // 系统时间和日期表示为某种整数time_t ...
- DataStage 的优化原则
DataStage Job优化指导原则之一:算法的优化. 任何程序的优化,第一点首先都是算法的优化.当然这一点并不仅仅局限于计算机程序的优化,实际生活中也处处可以体现这一点.条条大路通罗 ...