1005.Spell It Right (20)
2016-08-11 18:20
393 查看
考查知识点:字符串处理
//思路:这题跟乙级1002很像,注释就不写了,╮(╯▽╰)╭,人越来越懒了,还不懂得就留言吧,,,
//思路:这题跟乙级1002很像,注释就不写了,╮(╯▽╰)╭,人越来越懒了,还不懂得就留言吧,,,
#include<cstdio> #include<cstring> #include<iostream> using namespace std; int main(){ char N[105]; gets(N); int len=strlen(N); int sum=0; for(int i=0;i<len;i++) sum+=(N[i]-'0'); char spell[10][7]={"zero","one","two","three","four","five","six","seven", "eight","nine"}; int divice[5]={0},k; if(sum==0) divice[k++]=sum%10; while(sum){ divice[k++]=sum%10; sum/=10; } for(int i=k-1;i>=0;i--){ printf("%s", spell[divice[i]]); if(i!=0) putchar(' '); } return 0; }
相关文章推荐
- linux 基本操作:
- Spring Boot学习记录(二)--thymeleaf模板
- ng-class用法
- C++基础学习笔记 - 函数模板
- 打地鼠游戏
- 在iOS开发中使用正则表达式分解字符串
- HTML转PDF工具(wkhtmltopdf)介绍,支持widows和linux
- 这里是原创,我的第一篇文章。
- js拼接html字符串注意事项
- 正则表达式 教程
- 命名元组
- tomcat正常启动后http://localhost:8080/报错404
- HDU 5821 Ball
- css初学精华笔记
- HDU 5821 乱搞
- jq-- CSS 盒模型
- leetcode:字符串之Length of Last Word
- const_cast
- 【原创】为公司期刊随意发文
- Luban(鲁班)——可能是最接近微信朋友圈的图片压缩算法