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> ...
随机推荐
- 深入浅出Koa
深入浅出Koa(1):生成器和Thunk函数 Koa是个小而美的Node.js web框架,它由Express的原班人马打造的, 致力于以一种现代化开发的方式构建web应用. 通过这个系列,你将能够理 ...
- 未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73”或它的某一个依赖项
未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf116 ...
- CLR 无法从 COM
上下文 0x50ece80 转换为 COM 上下文 0x50ecf38,这种状态已持续 60 秒.拥有目标上下文/单元的线程很有可能执行的是非泵式等待或者在不发送 Windows 消息的情况下处理一个 ...
- 查看端口号他所占用的exe应用程序
- 我眼中的C#3.0 摘自于网络:http://www.cnblogs.com/joinger/articles/1297237.html
每次有新技术发布时,我们总能感受到两种截然不同的情绪: 一种是恐惧和抵抗,伴随着这种情绪的还有诸如"C# 2.0用的挺好的,为什么要在C# 3.0搞到那么复杂?"或者"我 ...
- iOS View 模糊效果(毛玻璃)
iOS View 模糊效果(毛玻璃) 相关资料 http://stackoverflow.com/questions/18404907/using-gpuimage-to-recreate-ios ...
- springMVC中ajax的运用于注意事项
ajax的运用: 注意事项: dataType:"json"在ajax中可写可不写(ajax能够自动识别返回值类型),写了更加规范,可以在ajax识别错误返回值类型的时候,指定返回 ...
- call_grant_dml.sql
set echo offpromptprompt =========================================================================== ...
- Alert()与Redirect()同时使用失效的问题
例如以下代码: echo "<script>alert('跳转到博客园');</script>"; redirect(“www.cnblogs.com”); ...
- SqlServer 查询死锁,杀死死锁进程
-- 查询死锁 select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sy ...