#include <cstdio>
#include <cstring>
char* change(int n){
switch(n){
case 0: return "zero"; break;
case 1: return "one"; break;
case 2: return "two"; break;
case 3: return "three"; break;
case 4: return "four"; break;
case 5: return "five"; break;
case 6: return "six"; break;
case 7: return "seven"; break;
case 8: return "eight"; break;
case 9: return "nine"; break;
}
}
int main(){
int sum = 0;
char a[105];
scanf("%s", a);
int len = strlen(a);
for(int i = 0; i < len; i++){
sum = sum + a[i] - '0';
}
int bai, shi, ge;
bai = sum / 100;
shi = sum / 10 % 10;
ge = sum % 10;
if(bai != 0){
printf("%s %s %s", change(bai), change(shi), change(ge));
}
else{
if(shi != 0){
printf("%s %s", change(shi), change(ge));
}
else{
printf("%s", change(ge));
}
}
return 0;
}
PAT a1005题解
最新推荐文章于 2021-09-16 21:49:46 发布