poj 2503 查字典
Description
Input
Output
Sample Input
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay atcay
ittenkay
oopslay
Sample Output
cat
eh
loops 其实用cin输入输出也可以
map<T,T>dd;
以及gets(a)与sscanf(a,"%s",str)配合用法;
a为char a[45];
#include<cstdio>
#include<string>
#include<iostream>
#include<map>
using namespace std; int main()
{ map<string,string>dic;
char a[],b[];
int i=;
char str[];
while(gets(str))
{
if(str[]=='\0'){break;}
sscanf(str,"%s %s",a,b);
dic[b]=a;
}
char c[];
string qq;
while(scanf("%s",c)!=EOF)
{
string s=c;
qq=dic[s];
if(qq.length()==)cout<<"eh"<<endl;
else cout<<qq<<endl; } return ;
}
poj 2503 查字典的更多相关文章
- poj 2503 Babelfish(字典树或着STL)
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 35828 Accepted: 15320 Descr ...
- poj 2503 Babelfish(字典树或map或哈希或排序二分)
输入若干组对应关系,然后输入应该单词,输出对应的单词,如果没有对应的输出eh 此题的做法非常多,很多人用了字典树,还有有用hash的,也有用了排序加二分的(感觉这种方法时间效率最差了),这里我参考了M ...
- RY哥查字典
时间限制: 1 s 空间限制: 16000 KB 题目等级 : 钻石 Diamond 题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天查字典 ...
- Codevs 2875 RY哥查字典
时间限制: 1 s 空间限制: 16000 KB 题目等级 : 钻石 Diamond 题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天 ...
- codevs2875RY哥查字典
题目链接:http://codevs.cn/problem/2875/ 题目描述 Description RY哥最近新买了一本字典,他十分高兴,因为这上面的单词都十分的和谐,他天天查字典. 输入描述 ...
- 题解报告:poj 2503 Babelfish(map)
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...
- POJ 2503 字典树
题目链接:http://poj.org/problem?id=2503 题意:给定一个词典,输入格式为[string1' 'string2] 意思是string2的值为string1. 然后给定一波 ...
- poj 2503 Babelfish(Map、Hash、字典树)
题目链接:http://poj.org/bbs?problem_id=2503 思路分析: 题目数据数据量为10^5, 为查找问题,使用Hash或Map等查找树可以解决,也可以使用字典树查找. 代码( ...
- poj 2503:Babelfish(字典树,经典题,字典翻译)
Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 30816 Accepted: 13283 Descr ...
随机推荐
- eclipse web and java ee development
1.打开Eclipse ->help ->install new software 2.Work with:http://download.eclipse.org/releases/gan ...
- 工作中常用的linux命令(2)
1.find :查找指定文件名的路径: 列出当前目录以及子目录中的所有文件: 在当前目录下寻找特定文件名的文件: 列出长度为零的文件: 2.ps :查看某个程序的进程,例如查询mongodb和mysq ...
- yii学习笔记--使用gii快速创建控制器和模型
配置gii 'gii'=>array( 'class'=>'system.gii.GiiModule', 'password'=>'123456',//使用gii的密码 // If ...
- 程序bug致损失400亿,判程序员坐牢? 搞笑我们是认真的
号外!号外!走过,路过,不要错过!日本 IT 业的狗血八卦继续独家放送啦!! 2015 年 9 月 3 日,随着东京最高法院驳回瑞穗证券的上诉,维持二审的原判结果,一个长达 10 年的诉讼终于画下了句 ...
- RTP、RTCP、RTSP 概念
用一句简单的话总结:RTSP发起/终结流媒体.RTP传输流媒体数据 .RTCP对RTP进行控制.同步. 之所以以前对这几个有点分不清,是因为CTC标准里没有对RTCP进行要求,因此在标准RTSP的代码 ...
- No bean named 'cxf' is defined
1.错误描述 严重:Exception starting filter CXFServlet org.springframework.beans.factory.NoSuchBeanD ...
- 利用ICSharpCode.SharpZipLib进行压缩
#ZipLib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. It is im ...
- SQLite笔记
一.SQLite下载: http://www.sqlite.org/download.html (或在NuGet下载安装) 二.SQLite操作: 1.添加引用System.Data.SQLite,如 ...
- BZOJ 1926: [Sdoi2010]粟粟的书架(主席树,二分答案)
BZOJ 1926: [Sdoi2010]粟粟的书架(主席树,二分答案) 题意 : 给你一个长为\(R\)宽为\(C\)的矩阵,第\(i\)行\(j\)列的数为\(P_{i,j}\). 有\(m\)次 ...
- 【BZOJ2301】【HAOI2011】Problem B(莫比乌斯反演)
[BZOJ2301][HAOI2011]Problem B(莫比乌斯反演) 题面 Description 对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y ...