1005. Spell It Right (20)
来源:互联网 发布:linux怎么设置用户密码 编辑:程序博客网 时间:2024/05/29 14:28
点击打开链接
由于字符串较大,必须用string接收,用char[]无法申请那么大
#include <stdint.h>#include <string.h>#include <string>#include <iostream>using namespace std;string x;char a[1000000];char num[][10]={"zero","one","two","three","four","five","six","seven","eight","nine"};int main(){freopen("in.txt","r",stdin);int ans=0;cin >> x;for(int i=0;i<x.length();i++){ans+=(x[i]-'0');}sprintf(a,"%d",ans);for(int i=0;i<strlen(a);i++){if(i==strlen(a)-1){printf("%s\n",num[ a[i]-'0' ]);}else{printf("%s ",num[ a[i]-'0' ]);}}return 0;}
0 0
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- 1005. Spell It Right (20)
- Problem 033——UVa 540 - Team Queue
- C#串口协议
- 黄聪:Scrapy 轻松定制网络爬虫
- 在Swift中应用Grand Central Dispatch(下)
- karma+phantomjs+mocha+chai使用心得
- 1005. Spell It Right (20)
- 【Linux网络】Linux Socket编程 TCP协议
- 磁盘分区
- 魔方动态壁纸android源码下载
- 改善javascript 性能
- 第一讲:iOS概述
- C语言变长数组 struct中char data[0]的用法
- 智能家居开发-android 蓝牙4.0 开发经验分享
- Android UI中视图不同状态时显示不同外观