hdu 1228
Description
需要注意的是:A和B的每一位数字由对应的英文单词给出.
Input
Output
Sample Input
three four + five six =
zero seven + eight nine =
zero + zero =
Sample Output
90
96
#include<bits/stdc++.h>
#define one 1
#define two 2
#define three 3
#define four 4
#define five 5
#define six 6
#define seven 7
#define eight 8
#define nine 9
#define zero 0
using namespace std;
char a[];
int i=;
int t=;
int num[];
int con=;
int flag=;
int main()
{ while(scanf("%c",&a[i])){
if(a[i]>='a'&&a[i]<='z')
{
con++;
i++;
}
else if(a[i]=='+') {i++;flag =t;}
else if(a[i]!='=')
{ if(con==)
{
if(a[i-]=='o'&&a[i-]=='n') num[t++]=;
else if(a[i-]=='t'&&a[i-]=='w') num[t++]=;
else if(a[i-]=='s') num[t++]=;
}
else if(con==)
{
if(a[i-]=='u') num[t++]=;
else if(a[i-]=='v') num[t++]=;
else if(a[i-]=='n') num[t++]=;
else if(a[i-]=='r') num[t++]=;
}
else if(con==)
{
if(a[i-]=='e') num[t++]=;
else if(a[i-]=='n') num[t++]=;
else if(a[i-]=='t') num[t++]=;
}
con=;
i++;
}
else if(a[i]=='=')
{
if(num[]==num[]&&num[]==) return ;
if(t==) cout<<num[]+num[]<<endl;
else if(t==&&flag==) cout<<num[]*+num[]+num[]<<endl;
else if(t==&&flag==) cout<<num[]+num[]*+num[]<<endl;
else cout<<num[]*+num[]+num[]*+num[]<<endl;
memset(a,NULL,sizeof(a));
i=;
con=;
memset(num,NULL,sizeof(num));
t=;
flag=;
} }
}
hdu 1228的更多相关文章
- hdu 1228 A + B
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1228 A + B Description 读入两个小于100的正整数A和B,计算A+B.需要注意的是: ...
- 题解报告:hdu 1228 A+B(字符串)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1228 Problem Description 读入两个小于100的正整数A和B,计算A+B. 需要注意 ...
- 【HDU 1228】A + B
题 Description 读入两个小于100的正整数A和B,计算A+B. 需要注意的是:A和B的每一位数字由对应的英文单词给出. Input 测试输入包含若干测试用例,每个测试用例占一行,格式 ...
- hdu 1228 A+B 字符串处理 超级大水题
中文意思不解释. 很水,我本来想用switch处理字符串,然后编译不通过...原来switch只能处理整数型的啊,我都忘了. 然后就有了很挫的一大串if代码了... 代码: #include < ...
- HDU 1228 A + B 浙江大学研究生冠军
Problem Description 读入两个小于100的正整数A和B,计算A+B. 须要注意的是:A和B的每一位数字由相应的英文单词给出. Input 測试输入包括若干測试用例,每一个測试用例 ...
- HDU 1228(字符串处理)
题意是将所给算式求出结果. 用的方法非常麻烦,开始没考虑到零也需要处理,以为遇上零直接跳过即可,知道发现零可以占位,比如 one zero 值为 10 而不是 1…… 代码如下: #include & ...
- HDU 1228 字符串到数字的转化
一道水题,练练字符串的输入输出 #include <cstdio> #include <cstring> using namespace std; ] , s2[]; int ...
- HDU 1698 & UESTC 1228 Just a hook
算是线段树中的一道水题了,必须用到懒操作,否则会超时.或者也可以刚开始不计算和,只更新节点,最后算整个线段的颜色和. 1.懒操作法 /* 908ms 3448KB in HDU OJ*/ #inclu ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
随机推荐
- 关闭 ubuntu System program problem detected
每次开机都出现: System program problem detected 很麻烦,关闭方法: vim /etc/default/apport # set this to 0 to disabl ...
- C开发基础--函数调用栈
发现有一些问题几乎是所有的新人都会遇到,而且也常因为缺乏一些基本的知识而无从下手.函数调用栈的内容就是其中之一.于是花点时间把以前写的内容整理出来. 程序在运行期间,内存中有一块区域,用来实现程序的函 ...
- centOS6.4 extundelete工具恢复rm -rf 删除的目录
PS:补充下,我在fedora 19上运行的时候遇到的一个问题: [root@localhost extundelete-]# ./configure Configuring extundelete ...
- thinkphp 3.23 第三方登录sdk集成包
本集成包在官方包上扩展了支付宝登录和微信,支持最新的3.23版本 config /* URL配置 */ 'URL_CASE_INSENSITIVE' => true, //默认fa ...
- Windows环境下 Node和NPM个性安装
常拿自己的电脑常用来测试各种Bug,所以始终奋斗在XP.IE6的环境下.让我们在如此级别的环境下,开始Node之路吧~~ 在过去,Node.js一直不支持在Windows平台下原生编译,需要借助Cyg ...
- There are no interfaces on which a capture can be done.
There are no interfaces on which a capture can be done. 今天启动了Wireshark 但是提示→There are no interfaces ...
- MVC中html转义问题(直接输出html的方法)
MVC中如果用@string(string是包含html代码的字符串)形式输出字符串,那么对应的html标签会自动转义,如果想直接输出html可用以下方法: @(new HtmlString( &qu ...
- 从客户端中检测到有潜在危险的 Request.Form 值。
使用富文本编辑器是经常会遇到这个问题,在MVC中解决方法很简单只要在对应的action上添加[ValidateInput(false)]即可
- 获取并设置ListView高度的方法
01 public void setListViewHeightBasedOnChildren(ListView listView) { 02 ListAdapter listAdapter ...
- [ZJOI3527][Zjoi2014]力
[ZJOI3527][Zjoi2014]力 试题描述 给出n个数qi,给出Fj的定义如下: 令Ei=Fi/qi.试求Ei. 输入 包含一个整数n,接下来n行每行输入一个数,第i行表示qi. 输出 有n ...