1005. Spell It Right (20)
2015-06-07 08:23
337 查看
#include<iostream> #include<map> #include<string> #include<stack> using namespace std; int main() { map<int, string>M; M[1]="one"; M[2]="two"; M[3]="three"; M[4]="four"; M[5]="five"; M[6]="six"; M[7]="seven"; M[8]="eight"; M[9]="nine"; M[0]="zero"; string S; while( cin>>S ) { int N=0; for( int i=0; i<S.size(); i++ ) N+=S[i]-'0'; stack<string>Stk; if(N==0) Stk.push(M[0]); while(N) { Stk.push(M[N%10]); N/=10; } cout<<Stk.top(); Stk.pop(); while(!Stk.empty()) { cout<<" "<<Stk.top(); Stk.pop(); } cout<<endl; } return 0; }
相关文章推荐
- mac OS X Yosemite 上编译hadoop 2.6.0/2.7.0及TEZ 0.5.2/0.7.0 注意事项
- 实体序列化反序列化 半成品
- 搜索文献总结
- iOS添加xib
- Java学习--知识点1--static关键字
- Maven环境配置
- 足彩基础知识入门(4)赛事数据库与预测平台基础概念介绍(一)
- 如何在 Ubuntu 中更改默认浏览器和 Email 客户端
- 关于人
- <心路历程> 致正在为梦想奋斗的自己
- Unity3d 游戏中的实时降噪-对Square Enix文档的研究与实现
- Unity3d 获取屏幕depth与normal
- MySQL 整体性能调优
- 易到用车最艰难时刻,未来赌什么?
- 谋事在人成事在天
- ISP Pipeline的关键模块之Demosaic( 三)
- xss攻击入门
- Intent之对象传递(Serializable传递对象和对象集合)
- ArcGIS 制作 “地图切片(tile)”
- Android-onInterceptTouchEvent()和onTouchEvent()总结