刷题时产生的不良反应

这题······

Description

大粤民国总统范裕燨(以下简称范统)因为一些奇怪的原因搬到了妹子国,这里的妹子说着一些歪果仁不懂的方言,范统无法与她们交流,十分的不爽。但是,幸运的是,他有两本神奇的字典(《妹子国语·从入门到放弃》和《妹子国基本法·语言》和《广州市<此处已被手动屏蔽>指导书·典狱长篇》/*三本?!*/)可以帮助他理解,但是,他炮的昧耔足足有酒忆⑦/*九亿七*/,所以请你来帮忙理解。

Input

行,每行输入一个词条*。

行是一个用于分隔的空行。

接下来是一段不超过个字符的消息**。

Output

将翻译成英语的妹子国语输出,请遵循妹子国消息的定义,每行一个单词。

假如消息中的单词是生僻字***,则输出"eh"。

Sample Input

dog ogdaycat atcaypig igpayfroot ootfrayloops oopslayfyxpaomei orzorzorzatcayittenkayoopslayorzorzorzxiefengzegaoshiqing

Sample Output

catehloopsfyxpaomei

HINT

*__每一个辞典条目应该包括用空格分隔开的一个英文单词和一个妹子国语单词。输入数据保证没有重复的词条。

**_消息在妹子国里的定义是,“消息是一个由妹子语单词组成的序列,每个单词之间用换行符分隔。妹子语的单词有不超过10个小写字母。”

***生僻字指《妹子国语·从入门到放弃》和《妹子国基本法·语言》两本字典中没有收录的单词。

因为有非常多的输入数据,建议使用scanf和printf。

输入:

dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay
fyxpaomei orzorzorz // 没有这个!!!

atcay
ittenkay
oopslay
orzorzorz           // 没有这个!!!
xiefengzegaoshiqing // 没有这个!!!

原题,你们懂的

You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them. 
Input 
Input consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message of up to 100,000 words. Each dictionary entry is a line containing an English word, followed by a space and a foreign language word. No foreign word appears more than once in the dictionary. The message is a sequence of words in the foreign language, one word on each line. Each word in the input is a sequence of at most 10 lowercase letters. 
Output 
Output is the message translated to English, one word per line. Foreign words not in the dictionary should be translated as “eh”. 
Sample Input 
dog ogday 
cat atcay 
pig igpay 
froot ootfray 
loops oopslay

atcay 
ittenkay 
oopslay

Sample Output 
cat 
eh 
loops 
Hint 
Huge input and output,scanf and printf are recommended.

好戏即将上演:

最初代码如下:

// p1038f.cpp

#if 0
#Sample Input
dog ogday
cat atcay
pig igpay
froot ootfray
loops oopslay
fyxpaomei orzorzorz

atcay
ittenkay
oopslay
orzorzorz
#Sample Output
cat
eh
loops
fyxpaomei

#Sample Input
gou qi
li ying
guo huo
jia fu
shen bi
si qu
yi zhi
wuliangfanyuxi paomeijiuyiqi

paomeijiuyiqi
ying
bi
qu
a
a
#Sample Output
wuliangfanyuxi
li
shen
si
eh
eh
#endif

#include <iostream>
#include <string>
#include <map>
#include <cstring>

#define SIZE 15001

using namespace std;

map<string, string> m;
map<string, bool> b;
string s1, s2;
char s[SIZE], _s[SIZE];

int main(int argc, char** argv)
{
	char c;
	
	for ( ; ; )
	{
		c = getchar();
		if (c == '\n')
		{
			break;
		}
		s[0] = c;
		scanf("%s %s", s + 1, &_s);
		getchar();
		s1 = s;
		s2 = _s;
		b[s2] = true;
		m[s2] = s1;
	}
	while (scanf("%s", s) != EOF)
	{
		s1 = s;
		if (b[s1])
		{
			cout << m[s1] << endl;
		}
		else
		{
			printf("eh\n");
		}
	}
	
	return 0;
}

好了,提交上去,OLE一分未给,就两个检查点······

其实这一题最高分就五十,第一检查点必定OLE

可是,第二检查点竟然错误!而且在电脑上上运行却是正确的!!!

第二个检查的输入的前面一段:

gou qi // 勾起

li ying

guo huo // 过火

jia fu // 贾府

shen bi // 神笔

si qu // <这个地方必须屏蔽>

yi zhi // 一直

wuliangfanyuxi paomeijiuyiqi // <这个地方也要屏蔽>

表示要吐了······


猜你喜欢

转载自blog.csdn.net/drtlstf/article/details/80684167
今日推荐