zzulioj 1810: water problem II (字符转换) 水

1810: water problem II

Time Limit: 1 Sec   Memory Limit: 128 MB
Submit: 90   Solved: 53

Submit Status Web Board

Description

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

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

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

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

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

Input

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

Output

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

Sample Input

one two

Sample Output

3

#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char a[10];
char b[10];
int zz(char *s)
{
	if(strcmp(s,"zero")==0)
		return 0;
	else if(strcmp(s,"one")==0)
		return 1;
	else if(strcmp(s,"two")==0)
		return 2;
	else if(strcmp(s,"three")==0)
		return 3;
	else if(strcmp(s,"four")==0)
		return 4;
	else if(strcmp(s,"five")==0)
		return 5;
	else if(strcmp(s,"six")==0)
		return 6;
	else if(strcmp(s,"seven")==0)
		return 7;
	else if(strcmp(s,"eight")==0)
		return 8;
	else if(strcmp(s,"nine")==0)
		return 9;
}
int main()
{
	while(scanf("%s%s",a,b)!=EOF)
	{
		int x=zz(a);
		int y=zz(b);
		printf("%d\n",x+y);
	}
	return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值