uva-10282-枚举
题意:语言翻译,
直接map即可
#include "pch.h"
#include <string>
#include<iostream>
#include<map>
#include<memory.h>
#include<vector> namespace cc
{
using std::cout;
using std::endl;
using std::cin;
using std::map;
using std::vector;
using std::string; constexpr int N = 100000; string eh = "eh"; map<string, string>strMaps;
void solve()
{
string str;
int k = 0;
while (getline(cin, str))
{
if (str.size() == 0)
break;
int index = str.find(" ");
string str1 = str.substr(0,index);
string str2 = str.substr(index+1);
strMaps[str2] = str1;
} using IT = map<string, string>::iterator;
while (getline(cin, str))
{
IT it = strMaps.find(str);
if (it == strMaps.end())
cout << eh << endl;
else
cout << it->second << endl;
} } }; int main()
{ #ifndef ONLINE_JUDGE
freopen("d://1.text", "r", stdin);
#endif // !ONLINE_JUDGE
cc::solve(); return 0;
}
uva-10282-枚举的更多相关文章
- UVa 12169 (枚举+扩展欧几里得) Disgruntled Judge
题意: 给出四个数T, a, b, x1,按公式生成序列 xi = (a*xi-1 + b) % 10001 (2 ≤ i ≤ 2T) 给出T和奇数项xi,输出偶数项xi 分析: 最简单的办法就是直接 ...
- UVa 140 (枚举排列) Bandwidth
题意较复杂,请参见原题=_=|| 没什么好说的,直接枚举每个排列就好了,然后记录最小带宽,以及对应的最佳排列. STL里的next_permutation函数真是好用. 比较蛋疼的就是题目的输入了.. ...
- UVa 1151 (枚举 + MST) Buy or Build
题意: 平面上有n个点,现在要把它们全部连通起来.现在有q个套餐,如果购买了第i个套餐,则这个套餐中的点全部连通起来.也可以自己单独地建一条边,费用为两点欧几里得距离的平方.求使所有点连通的最小费用. ...
- Even Parity UVA - 11464 (枚举)
从来没有觉得枚举有多费脑子的.但是这道题还是很香的. 思路:就是非常简单的枚举啦. 从一般的枚举开始考虑.一般的做法就是在所有的格子中有两种状态1, 0. 而一共有225个格子,所有一共要枚举的情 ...
- UVa 1354 枚举子集 Mobile Computing
只要枚举左右两个子天平砝码的集合,我们就能算出左右两个悬挂点到根悬挂点的距离. 但是题中要求找尽量宽的天平但是不能超过房间的宽度,想不到要怎样记录结果. 参考别人代码,用了一个结构体的vector,保 ...
- UVA 10282 (13.08.18)
Problem C: Babelfish You have just moved from Waterloo to a big city. The people here speakan incomp ...
- Uva 11754(枚举+中国剩余定理)
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #inclu ...
- 10年省赛-Greatest Number (二分+暴力) + 12年省赛-Pick apples(DP) + UVA 12325(暴力-2次枚举)
题意:给你n个数,在里面取4个数,可以重复取数,使和不超过M,求能得到的最大的数是多少: 思路:比赛时,和之前的一个题目很像,一直以为是体积为4(最多选择四次)的完全背包,结果并不是,两两求和,然后二 ...
- UVa 10465 Homer Simpson (枚举)
10465 - Homer Simpson Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onli ...
- uva 11825 Hackers' Crackdown (状压dp,子集枚举)
题目链接:uva 11825 题意: 你是一个黑客,侵入了n台计算机(每台计算机有同样的n种服务),对每台计算机,你能够选择终止一项服务,则他与其相邻的这项服务都终止.你的目标是让很多其它的服务瘫痪( ...
随机推荐
- 关于class produre
很好理解 type TMessageHandler = class //使得回车消息转换成Tab消息 class procedure AppMessage(var Msg:TMsg;var Handl ...
- 自定义抛出throw 对象练习
package ltb6w; import java.util.*; public class Bank { private String select; private String select2 ...
- PHP 函数获取文件名
<?php // php 获取 文件名 function getExt($url){ $arr = parse_url($url); // URL 字符串予以解析,并将结果返回数组中 //pr ...
- 直接突破百度网盘,用IDM或者迅雷下载。
直接突破百度网盘,用IDM或者迅雷下载.推荐浏览器: 360 ,CHORME360,: 打开网盘下载页,然后F12→找到CONSOLE→刷新→输入代码“Object.defineProperty(th ...
- webscoket通信初步(一)
只要动手做起来,多投入时间和精力.耐心去研究,以大多人的智商加google,平时遇到的大部分问题我们都是可以自己解决的,大部分的知识我们都是可以掌握的. 我们都知道http协议是单向请求的,无法实现双 ...
- firefox驱动的下载地址
https://www.seleniumhq.org/download/
- Python——pandas读取JSON数据,xml,html数据(python programming)
- 学习笔记之DevOps
DevOps - Wikipedia https://en.wikipedia.org/wiki/DevOps DevOps (a clipped compound of "developm ...
- Windows和pthread中提供的自旋锁
Windows和POSIX中都提供了自旋锁,我们也可以通过C++11的atomic来实现自旋锁.那么两者性能上面是什么关系?先引入实现代码: #ifndef __spinlock_h__ #defin ...
- mybatis 整合spring之mapperLocations配置的问题(转)
以防忘记,收集一下别人的文章吧 https://www.cnblogs.com/1xin1yi/p/7373739.html 今天尝试spring整合mybatis时遇到这么一个问题,就是在配置sql ...