# PAT 1005. Spell It Right (20)

<pre name="code" class="cpp">#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<stack>
using namespace std;
#define INF 100000000
#define min(a,b) a<b?a:b

int main()
{
const char *str[10]={"zero","one","two","three","four","five","six","seven","eight","nine"};
char str2[102];
int sum=0;
scanf("%s",str2);
for(int i=0;str2[i]!='\0';i++)
sum+=str2[i]-'0';
int s=sum;
int t=1,first=0;
while(s)
{
if(!first)
{     t=1;
first=1;
}
else
t*=10;

s/=10;
}
first=0;
s=sum;
int a,b;
while(t)
{
a=s/t;
if(!first)
{
printf("%s",str[a]);
first=1;
}
else
printf(" %s",str[a]);
s%=t;
t/=10;
}
printf("\n");

return 0;
}


#### PAT - 甲级 - 1005. Spell It Right (20)

2016-07-02 20:35:43

#### 1005. Spell It Right (20)解题思路

2016-06-25 06:40:15

#### 1005. Spell It Right (20)[C语言]

2017-05-06 21:31:48

#### PAT Advanced 1005. Spell It Right (20) (C语言实现)

2017-05-18 23:47:44

#### （PAT）1005. Spell It Right (20)

2014-01-08 22:40:55

#### 【PAT】1005. Spell It Right (20)

2018-03-21 08:36:54

#### PAT 1005. Spell It Right(20)

2018-01-16 09:58:24

#### PAT: 1005. Spell It Right (20)

2014-03-23 09:47:18

#### [PAT]1005. Spell It Right (20)

2014-11-10 13:35:40

#### pat 1005. Spell It Right (20)

2015-07-17 13:23:32