PAT 1005 Spell It Right 字符串处理
Input Specification:
Output Specification:
Sample Input:
Sample Output:
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
int i,sum=;
string str;
string ans;
string a[]={"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
cin>>str;
for(i=; i<str.size(); i++)
{
sum+=str[i]-'';
}
ans=to_string(sum);
cout<<a[ans[]-''];//第一个读音
for(i=;i<ans.size();i++)
{
cout<<" "<<a[ans[i]-''];
}
return ;
}
PAT 1005 Spell It Right 字符串处理的更多相关文章
- PAT 1005 Spell It Right
1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all ...
- PAT甲1005 Spell it right【字符串】
1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all th ...
- PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642
PAT (Advanced Level) Practice 1005 Spell It Right (20 分) 凌宸1642 题目描述: Given a non-negative integer N ...
- PAT 甲级 1005 Spell It Right (20)(代码)
1005 Spell It Right (20)(20 分) Given a non-negative integer N, your task is to compute the sum of al ...
- PAT 甲级 1005 Spell It Right (20 分)
1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all th ...
- PAT 甲 1005. Spell It Right (20) 2016-09-09 22:53 42人阅读 评论(0) 收藏
1005. Spell It Right (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given ...
- PAT 1005
1005. Spell It Right (20) Given a non-negative integer N, your task is to compute the sum of all the ...
- 1005 Spell It Right (20 分)
1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all th ...
- PTA 1005 Spell It Right (20)(20 分)水题
1005 Spell It Right (20)(20 分) Given a non-negative integer N, your task is to compute the sum of al ...
随机推荐
- 【原创】这道Java基础题真的有坑!我也没想到还有续集。
前情回顾 自从我上次发了<这道Java基础题真的有坑!我求求你,认真思考后再回答.>这篇文章后.我通过这样的一个行文结构: 解析了小马哥出的这道题,让大家明白了这题的坑在哪里,这题背后隐藏 ...
- java基础集合简介Map(三)下
--Map接口简介 今天来看一看map集合,map映射接口,用于存放键值对,<key,value>,通过key来查找value,顾名思义key不能为空,唯一且不重复,不然底层怎么查呢! 可 ...
- 知识图谱推理与实践(3) -- jena自定义builtin
在第2篇里,介绍了jena的The general purpose rule engine(通用规则引擎)及其使用,本篇继续探究,如何自定义builtin. builtin介绍 先回顾builtin为 ...
- Linux服务器部署.Net Core笔记:二、安装FTP
1.安装 安装ftp:yum install -y vsftpd 将ftp设置开机启动:systemctl enable vsftpd.service 2.配置 安装好后在ftp配置文件里进行配置 : ...
- C#线程学习笔记三:线程池中的I/O线程
本笔记摘抄自:https://www.cnblogs.com/zhili/archive/2012/07/20/MultiThreads.html,记录一下学习过程以备后续查用. 一.I/O线 ...
- aspnet boilerplate 随笔一
使用abp模板进行项目开发: 1:准备工作:我使用v2.x版本,所以会依赖.net core 2.2 查看并更新本地环境: 更新.net core版本:cmd 运行 dotnet --version查 ...
- GIS面试小知识点
1.什么是地理信息系统?简述其基本功能 它是随着地理科学.计算机技术.遥感技术和信息科学的发展而产生的一门科学.就应用而言,是对空间数据进行 组织.管理.分析.显示 的系统.其实本质上它探讨的就是 ...
- Codeforces Round #608 (Div. 2) 题解
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...
- [转]加密算法(DES,AES,RSA,MD5,SHA1,Base64)比较和项目应用
原文链接:http://www.cnblogs.com/sochishun/p/7028056.html 加密技术通常分为两大类:"对称式"和"非对称式". 对 ...
- react-组件间的传值
父组件向子组件传值 父组件通过属性进行传递,子组件通过props获取 //父组件 class CommentList extends Component{ render(){ return( < ...