//就是一个简单的字符串配对~~用map来解决很easy

#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
int n;
while (cin>>n && n!=) {
string ip , name;
string tmp;
map<string,string> m;
map<string,string>::iterator iter;
map<string,string> ans;
while(n--){
cin>> name >> ip;
if ((iter = m.find(ip) )!= m.end()) {
ans.insert(make_pair(iter->second, name+"is the MaJia of "+ iter->second));
m.erase(iter);
}else
m.insert(make_pair(ip, name));
}
for(iter = ans.begin() ; iter != ans.end(); iter++)
cout << iter->second << endl;
cout << endl;
}
return ;
}

Sicily 1027. MJ, Nowhere to Hide的更多相关文章

  1. sicily 1027 MJ, Nowhere to Hide 字符串匹配与排序

    1027. MJ, Nowhere to Hide Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description On BBS, th ...

  2. View and Data API Tips: Hide elements in viewer completely

    By Daniel Du With View and Data API, you can hide some elements in viewer by calling "viewer.hi ...

  3. sicily 中缀表达式转后缀表达式

    题目描述 将中缀表达式(infix expression)转换为后缀表达式(postfix expression).假设中缀表达式中的操作数均以单个英文字母表示,且其中只包含左括号'(',右括号‘)’ ...

  4. jquery的show/hide/toggle详解

    通过阅读源码我们发现show,hide,toggle调用了showHide和isHidden这2个方法,所以我们要搞明白原理必须先看一下这2个方法. jQuery.fn.extend({ ...... ...

  5. sicily 1934. 移动小球

    Description 你有一些小球,从左到右依次编号为1,2,3,...,n. 你可以执行两种指令(1或者2).其中, 1 X Y表示把小球X移动到小球Y的左边, 2 X Y表示把小球X移动到小球Y ...

  6. Jquery:hide一个元素,需要注意的问题(offset)

    $(".load_more").css('display','none'); 或 $(that.more).find("strong").hide(); 需要注 ...

  7. jquery的hide()和show()

    jquery用hide()和show()函数来控制html元素的显示和隐藏. hide()和show()都可以带参数的,hide(1000)表示隐藏所需的时间为1秒.此外还可以用slow,fast参数 ...

  8. Light OJ 1027 - A Dangerous Maze (数学-期望)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1027 题目大意: 一个迷宫, 有n个门,选择一个门花费为|ai|, 如果选择的 ...

  9. (期望)A Dangerous Maze(Light OJ 1027)

    http://www.lightoj.com/volume_showproblem.php?problem=1027 You are in a maze; seeing n doors in fron ...

随机推荐

  1. insert …select …带来的死锁问题

    mysql中 insert …select …带来的问题 当使用insert...select...进行记录的插入时,如果select的表是innodb类型的,不论insert的表是什么类型的表,都会 ...

  2. win32com操作word(3):导入VBA常量

    导入VBA常量方法:http://blog.sina.com.cn/s/blog_a73687bc0101k8x8.html 我们之前说过,win32com组件为python提供处理COM组件(.dl ...

  3. UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

    py文件直接在cmd窗口用python命令执行时正常:代码逐句在ipython中也正常:但是, 在wingIDE中运行报错“UnicodeEncodeError: 'ascii' codec can' ...

  4. Gym - 101673:B Craters (几何,求凸包)

    题意:给定几个圆,求最短的围合,把这几个包围起来,而且到圆的距离都不小于10. 思路:把每个圆的半径+10,边等分5000份,然后求凸包即可. #include<bits/stdc++.h> ...

  5. Python基础入门知识

    本节内容 Python介绍 发展史 Python 2 or 3? 安装 Hello World程序 变量 用户输入 模块初识 .pyc是个什么鬼? 数据类型初识 数据运算 表达式if ...else语 ...

  6. poj1094Sorting It All Out——拓扑排序

    题目:http://poj.org/problem?id=1094 看到此题,首先觉得这是一种层层递进的关系,所以可以想到用拓扑排序: 就像人工排序,每次需要找到一个最小的,再找到新的最小的……所以用 ...

  7. 贪心+等价转化 HDU 1489

    等价转换,题意简单来讲如下:在一条直线均匀分布N个村庄,每个村庄要么买酒,要么卖酒,且村庄的买酒和卖酒供需平衡,总和为0,把k个单位的酒从一个村庄运到相邻的村庄需要k个单位的劳动力,输出最小的劳动力. ...

  8. Python文件运行时报TabError: inconsistent use of tabs and spaces in indentation

    1. 问题描述 Python文件运行时报TabError: inconsistent use of tabs and spaces in indentation 2. 问题原因 tab 和 space ...

  9. SQL一次性插入大量数据【转载】

    在SQL Server 中插入一条数据使用Insert语句,但是如果想要批量插入一堆数据的话,循环使用Insert不仅效率低,而且会导致SQL一系统性能问题.下面介绍SQL Server支持的两种批量 ...

  10. 【237】◀▶IEW-Unit02

    Unit 2 Sport I.状语从句在雅思写作中的运用 公式: 主句+状语从句连接词+从句 =状语从句连接词+从句,主句 1. 时间状语从句 I. when, while, as 1. When+A ...