sicily 1027
来源:互联网 发布:数据分析师有哪些证书 编辑:程序博客网 时间:2024/04/27 22:32
开始写题解
很简单的map
#include<iostream>
#include<map>
using namespace std;
map<string,string>m;
map<string,string>p;
int main()
{
int n;
while(cin >> n && n)
{
m.clear();
p.clear();
string s1,s2;
for(int i = 0; i < n; i++)
{
cin >> s1 >> s2;
if(m.find(s2) == m.end())
m[s2] = s1;
else
{
map<string,string>::iterator it = m.find(s2);
p[it->second] = s1;
}
}
for(map<string,string>::iterator it = p.begin(); it != p.end(); it++)
cout << it->second << " is the MaJia of " << it->first << endl;
cout << endl;
}
}
- Sicily 1027
- sicily 1027
- sicily 1027
- sicily 1027
- sicily 1027
- Sicily 1027 MJ, Nowhere to Hide
- sicily 1027 MJ,nowhere to hide
- sicily 1027 MJ, Nowhere to Hide
- sicily 1027 MJ和map函数详解
- sicily 1027 MJ, Nowhere to Hide
- sicily 1007
- sicily 1795
- sicily 1036
- sicily 1419
- sicily 1889
- sicily 1684
- sicily 1686
- sicily 1004
- Java多线程的volatile关键字
- dxsudio三维交互初见
- Spring容器对象(BeanFactory)
- HTTP协议详解
- TCP报文中的SYN,FIN,ACK,PSH,RST,URG
- sicily 1027
- 安装. Net 3.5
- 牛腩学ASP.NET MVC
- ant 入门使用指南
- linux 按需预读策略追踪(源码参考centos6.0内核源码)
- 23种设计模式详解
- 读《游戏之旅-我的编程感悟》笔记
- NANDFLASH 详述
- 数据库遭到攻击