zqoj 1810: water problem II 【(map的用法)水题】【郑大校赛】

1810: water problem II

Time Limit: 1 Sec   Memory Limit: 128 MB
Submit: 98   Solved: 56

Submit Status Web Board

Description

相信大家对A+B问题最熟悉了。

实验室有个女人(传说中的潘同学)经常卡在这种题目上。。。

有一次,他边敷着面膜边做题,遇见了这样一个题目:

输入两个表示数的英文单词,输出他们的和。(当然输入的是英文,输出的是10进制数)

他头脑太ben了,想了半天没想出来怎么做?你能帮助他么?

Input

多组输入数据。每组数据输入两个表示数的英文单词(输入的数据是0-9)

Output

对于每组数据输出一个和。

Sample Input

one two

Sample Output

3

HINT

Source

郑大第九届校赛热身赛


代码:


#include 
#include 
#include 
#include 
#include 
using namespace std;
int main()
{
	mapmp;
	mp["zero"]=0;mp["one"]=1;mp["two"]=2;mp["three"]=3;mp["four"]=4;
	mp["five"]=5;mp["six"]=6;mp["seven"]=7;mp["eight"]=8;mp["nine"]=9;
	char a[10],b[10];
	while(scanf("%s%s",a,b)!=EOF)
	{
		printf("%d\n",mp[a]+mp[b]);
	}
	return 0;
}


你可能感兴趣的:(其他oj氺题)