PAT程序设计考题——甲级1005( Spell It Right ) C++实现
来源:互联网 发布:123d打印软件 编辑:程序博客网 时间:2024/06/05 13:34
#include<iostream>
#include<math.h>
#include<algorithm>
#include<map>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int main(){
map<int,string> mp;
mp[1]="one";
mp[0]="zero";
mp[2]="two";
mp[3]="three";
mp[4]="four";
mp[5]="five";
mp[6]="six";
mp[7]="seven";
mp[8]="eight";
mp[9]="nine";
string str;
cin>>str;
int sum=0;
for(int i=0;str[i];i++)
sum+=str[i]-'0';
int store[100010],num=0;
do{
store[num++]=sum%10;
sum=sum/10;
}while(sum);
for(int i=num-1;i>=0;i--)
{cout<<mp[store[i]];
if(i>0) cout<<" ";
}
return 0;
}
#include<math.h>
#include<algorithm>
#include<map>
#include<stack>
#include<string>
#include<vector>
using namespace std;
int main(){
map<int,string> mp;
mp[1]="one";
mp[0]="zero";
mp[2]="two";
mp[3]="three";
mp[4]="four";
mp[5]="five";
mp[6]="six";
mp[7]="seven";
mp[8]="eight";
mp[9]="nine";
string str;
cin>>str;
int sum=0;
for(int i=0;str[i];i++)
sum+=str[i]-'0';
int store[100010],num=0;
do{
store[num++]=sum%10;
sum=sum/10;
}while(sum);
for(int i=num-1;i>=0;i--)
{cout<<mp[store[i]];
if(i>0) cout<<" ";
}
return 0;
}
阅读全文
0 0
- PAT程序设计考题——甲级1005( Spell It Right ) C++实现
- PAT甲级 1005:Spell it Right
- pat甲级1005-Spell It Right
- PAT程序设计考题——甲级1043(Is It a Binary Search Tree ) C++实现
- PAT程序设计考题——甲级1065( A+B and C (64bit) ) C++实现
- 【PAT甲级】【C++】1005. Spell It Right (20)
- PAT(甲级)1005. Spell It Right (20)
- PAT - 甲级 - 1005. Spell It Right (20)
- PAT甲级.1005. Spell It Right (20)
- 【PAT甲级】1005. Spell It Right (20)
- PAT甲级1005. Spell It Right (20)
- PAT甲级1005. Spell It Right
- PAT 甲级 1005. Spell It Right
- PAT甲级 1005. Spell It Right (20)
- [PAT-甲级]1005.Spell It Right
- PAT甲级1005. Spell It Right
- PAT 甲级 1005. Spell It Right
- PAT甲级1005. Spell It Right (20)
- DDR布线规则与过程
- android crash 四 ANR原因分析及解决方法
- 素数的距离
- eclipse自动补全失效
- java项目编程规约
- PAT程序设计考题——甲级1005( Spell It Right ) C++实现
- .Net 下未捕获异常的处理
- CentOS 7 64bit下安装并初始化mysql 5.7 完整过程
- 大爱线性表
- 百度地图SDK 配置问题
- Windows10 安装Ubuntu子系统,解决从应用商店下载慢的问题。
- 文件以及DB同步方案选择
- 二叉树的创建和文本显示
- js open打开新窗口操作父窗口