PAT1005
水题,和中文没啥区别不说了。
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm> using namespace std; char maps[][]={
{"zero"},{"one"},{"two"},{"three"},{"four"},{"five"},{"six"},{"seven"},{"eight"},{"nine"}
}; int main()
{
char ch;
int sum=;
while ((ch = getchar()) != '\n')
{
sum += (ch -'');
}
int a[],i=;
while (sum > )
{
a[i] = sum%;
sum /= ;
i++;
}
a[i] = sum;
while (i>)
{
cout<<maps[a[i]]<<" ";
i--;
}
cout<<maps[a[]]<<endl;
return ;
}
PAT1005的更多相关文章
- PAT1005—— 继续(3n+1)猜想
卡拉兹(Callatz)猜想已经在1001中给出了描述.在这个题目里,情况稍微有些复杂. 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数.例如对n=3进行验证的时候, ...
- PAT---1005. Spell It Right (20)
#include<iostream> #include<stack> #include<string.h> ]= {"zero", " ...
- pat1005. Spell It Right (20)
1005. Spell It Right (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given ...
- PAT1005 继续(3n+1)猜想
卡拉兹(Callatz)猜想已经在1001中给出了描述.在这个题目里,情况稍微有些复杂. 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数.例如对 n=3 进行验证的时 ...
- PAT-1005 Spell It Right 解答(C/C++/Java/python)
1.Description: Given a non-negative integer N, your task is to compute the sum of all the digits of ...
- PAT (Advanced Level) Practice 1001-1005
PAT (Advanced Level) Practice 1001-1005 PAT 计算机程序设计能力考试 甲级 练习题 题库:PTA拼题A官网 背景 这是浙大背景的一个计算机考试 刷刷题练练手 ...
随机推荐
- G - Zombie’s Treasure Chest(动态规划专项)
G - Zombie’s Treasure Chest Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d &am ...
- ajax传递的数据类型json传递
$(".del_goods").click(function(){ //删除选中的商品 var clear_data = [];//数组 $("input[name='c ...
- go pkg
fmt Scanln用来读取输入数据 示例: package main import ( "fmt" "os" "time" ) func ...
- Value '0000-00-00' can not be represented as java.sql.Date
Value '0000-00-00' can not be represented as java.sql.Date 时间 2014-07-30 09:00:50 ITeye-博客 原文 http: ...
- C++设计模式-参考资料
设计模式实例讲解: http://www.cnblogs.com/jiese/tag/ http://www.cnblogs.com/wanggary/category/294620.html 设计模 ...
- form表单验证提示语句
<input id="idcardcode" name="idcardcode" class="form-control" ...
- Linux - CentOS6.5服务器搭建与初始化配置详解(下)
传送带:Linux - CentOS6.5服务器搭建与初始化配置详解(上) 继续接着上面的安装,安装完后会出现下面界面 点击reboot重启 重启后可以看到下面的tty终端界面 因为这就是最小化安装 ...
- js通过keyCode值判断单击键盘上某个键,然后触发指定的事件
当单击按键时触发事件 document.onkeydown = function (e) { e = e || event; if (e.keyC ...
- spark 编程向导
http://spark.apache.org/docs/latest/programming-guide.html
- IoC容器Autofac正篇之依赖注入(七)
依赖注入,这个专业词我们可以分为两个部分来理解: 依赖,也就是UML中描述事物之间关系的依赖关系,依赖关系描述了事物A在某些情况下会使用到事物B,事物B的变化会影响到事物A: 注入,医生通过针头将药物 ...