P - A + B(第二季水)
Description
Input
Output
Sample Input
Sample Output
#include <iostream>
#include <string>
using namespace std;
int g(string str)
{
if(str=="zero")return ;
if(str=="one")return ;
if(str=="two")return ;
if(str=="three")return ;
if(str=="four")return ;
if(str=="five")return ;
if(str=="six")return ;
if(str=="seven")return ;
if(str=="eight")return ;
if(str=="nine")return ;
}
int main()
{
string a[];
while(cin>>a[]>>a[]>>a[]){
int i,k1,k2;
for(i=;;i++){
cin>>a[i];
if(a[i]=="=")break;
}
if(a[]=="zero"&&a[]=="+"&&a[]=="zero"&&a[]=="=")break;
if(a[]=="+"){
k1=g(a[]);
if(a[]=="=")k2=g(a[]);
else k2=g(a[])*+g(a[]);
}
else{
k1=*g(a[])+g(a[]);
if(a[]=="=")k2=g(a[]);
else k2=g(a[])*+g(a[]);
}
cout<<k1+k2<<endl;
}
//system("pause");
return ;
}
依旧灵活使用字符串即可
P - A + B(第二季水)的更多相关文章
- F - The Fun Number System(第二季水)
Description In a k bit 2's complement number, where the bits are indexed from 0 to k-1, the weight o ...
- D - Counterfeit Dollar(第二季水)
Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...
- S - 骨牌铺方格(第二季水)
Description 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数. 例如n=3时,为2× 3方格,骨牌的铺放方案有三种, ...
- R - 一只小蜜蜂...(第二季水)
Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. ...
- I - Long Distance Racing(第二季水)
Description Bessie is training for her next race by running on a path that includes hills so that sh ...
- Y - Design T-Shirt(第二季水)
Description Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA ...
- N - Robot Motion(第二季水)
Description A robot has been programmed to follow the instructions in its path. Instructions for the ...
- B - Maya Calendar(第二季水)
Description During his last sabbatical, professor M. A. Ya made a surprising discovery about the old ...
- T - 阿牛的EOF牛肉串(第二季水)
Description 今年的ACM暑期集训队一共有18人,分为6支队伍.其中有一个叫做EOF的队伍,由04级的阿牛.XC以及05级的COY组成.在共同的集训生活中,大家建立了深厚的 ...
- E - Number Sequence(第二季水)
Description A single positive integer i is given. Write a program to find the digit located in the p ...
随机推荐
- ubuntu 快捷图标
ubuntu的图标都存在 /usr/share/applications下 图标是Desktop的后缀 首先gedit /usr/share/applications/xx.Desktop xx为应用 ...
- UVA11361 Investigating Div-Sum Property(数位dp)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud 题目意思:问在区间[A,B]有多少个数不仅满足自身是k的倍数,而且其各个位数上的和 ...
- css white-space
以下是对上面几个属性的测试效果如下: 具体代码如下: <!DOCTYPE html> <html lang="en"> <head> <m ...
- BZOJ 1458 士兵占领
http://www.lydsy.com/JudgeOnline/problem.php?id=1458 题意:n x m的棋盘,k个位置不能放,每行和每列都有要求至少的士兵,求能否有最少的满足条件的 ...
- USB Mass Storage学习笔记-STM32+FLASH实现U盘
一.内容概述 采用STM32内部自带USB控制器外加大页NAND FLASH K9F1G08U0A实现一个128M的U盘. 1.STM32的USB控制器 STM32F103的MCU自带USB从控制器 ...
- Linux实现SSH无密码登录(对目录权限的设置非常详细,可以参考一下)
假设服务器IP地址为192.168.1.1,机器名:cluster.hpc.org 客户端IP地址为172.16.16.1,机器名:p470-2.wangrx.sioc.ac.cn 客户端用户yzha ...
- UNIX网络编程---TCP客户/服务器程序示例(五)
一.概述 客户从标准输入读入一行文本,并写给服务器 服务器从网络输入读入这行文本,并回射给客户 客户从网络输入读入这行回射文本,并显示在标准输出上 二.TCP回射服务器程序:main函数 这里给了函数 ...
- Unix/Linux环境C编程入门教程(31) 数学函数带你战胜企业面试
1.函数介绍: abs()acos()asin()atan()atan2()ceil()cos()cosh()exp()frexp()ldexp()log()log10()pow()sin()sinh ...
- java中classPath和Xpath问题
java中classPath和Xpath问题 今天遇到一个问题想获取classpath对应的目录,开始还以为java源代码可以像spring配置文件.xml中一样通过classpath:来获取对应的路 ...
- H.264 RTP 封包格式
H.264 视频 RTP 负载格式 1. 网络抽象层单元类型 (NALU) NALU 头由一个字节组成, 它的语法如下: +---------------+ |0|1|2|3|4|5|6|7 ...