PAT (Advanced Level) 1005. Spell It Right (20)
简单题。
- #include<iostream>
- #include<cstring>
- #include<cmath>
- #include<algorithm>
- #include<cstdio>
- #include<vector>
- using namespace std;
- const int maxn=+;
- char s[maxn];
- int tmp[maxn],tot;
- char ans[][]={
- "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"
- };
- int main()
- {
- scanf("%s",s);
- int num=; for(int i=;s[i];i++) num=num+s[i]-'';
- if(num==)
- {
- printf("zero\n");
- }
- else{
- tot=; while(num) tmp[tot++]=num%,num=num/;
- for(int i=tot-;i>=;i--)
- {
- printf("%s",ans[tmp[i]]);
- if(i>) printf(" ");
- else printf("\n");
- }
- }
- return ;
- }
PAT (Advanced Level) 1005. Spell It Right (20)的更多相关文章
- PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642
PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...
- PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642
PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...
- PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642
PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...
- PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642
PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642 题目描述: A reversible prime in any n ...
- PTA (Advanced Level) 1005 Spell It Right
Spell It Right Given a non-negative integer N, your task is to compute the sum of all the digits of ...
- PAT (Advanced Level) Practice 1152 Google Recruitment (20 分)
In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the p ...
- PAT (Advanced Level) 1054. The Dominant Color (20)
简单题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #inc ...
- PAT (Advanced Level) 1027. Colors in Mars (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...
- PAT (Advanced Level) 1019. General Palindromic Number (20)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
随机推荐
- Linux教程之配置权限受限制的SFTP
SFTP 在Linux下是一个很方便很安全的文件传输工具,我常常用它在Linux服务器上替代传统的ftp来传输文件.众所周知SFTP账号是基于SSH账号的,默认情况下访问服务器的权限很大,下面的教程就 ...
- Sublime text 3 如何格式化HTML代码
使用Sublime text 3 编写代码是一种享受,使用Sublime text 3 格式化HTML代码,需要安装插件,具体安装步骤如下: 1.打开菜单->首选项->插件控制,输入 ...
- nginx proxy优化
常用优化要点 当nginx用于反向代理时,每个客户端将使用两个连接: 一个用于响应客户端的请求,另一个用于到后端的访问: 如果机器是两核CPU,例如: 1 2 $ grep ^proces /proc ...
- HDU5908 Abelian Period 暴力
题目大意:将一个数组分成长度为k的几个连续区间,如果每个区间内各个元素出现的次数相同,则称k为一个阿贝尔周期,从小到大打印所有阿贝尔周期,数据间加空格. 题目思路:map+暴力 #include< ...
- ios 获得版本号
获取iphone的系统信息使用[UIDevice currentDevice],信息如下: [[UIDevice currentDevice] systemName]:系统名称,如iPhone OS ...
- A New Change Problem
题目链接 /* 给定两个互质的数,a,b,求这两个数不能表示的数的最大值和个数. 最大值=a*b-a-b; 个数 =(a-1)*(b-1)/2; */ #include <set> #in ...
- Jenkins+SonarQube代码质量检查自动化
基础概念百度百科:Jenkins是基于Java开发的一种持续集成工具,用于监控持续重复的工作,功能包括:1.持续的软件版本发布/测试项目.2.监控外部调用执行的工作.前面[Sonarqube 代码质量 ...
- HDU1874 最短路 SPFA
最短路 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 24 Solved: 17 [Submit][Status][Web Board] Descr ...
- Mysql主从备份、主主备份
简单介绍mysql双机,多机异地热备简单原理实战. 双机热备的概念简单说一下,就是要保持两个数据库的状态自动同步.对任何一个数据库的操作都自动应用到另外一个数据库,始终保持两个数据库数据一致. 这样做 ...
- 转:浏览器与WEB服务器工作过程举例
用户通过“浏览器”访问因特网上的WEB服务器,浏览器和服务器之间的信息交换使用超文本传输协议(HTTP--HyperText Transfer Protocol). 例:用户访问东南大学主页 Http ...