#include<stdio.h> #include<string.h> char alp[10][10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; char str[1200]; int main() { scanf("%s",str); int len=strlen(str); int sum=0; for(int i=0 ; i<len ; ++i) sum+=str[i]-‘0‘; if(sum==0) //判0,直接输出zero { printf("zero"); return 0; } int RESI=0; int RES[100]; while(sum!=0) { RES[RESI]=sum%10; sum/=10; ++RESI; } for(int i=RESI-1 ; i>=0 ; --i) { printf("%s",alp[RES[i]]); if(i!=0) printf(" "); } return 0; }
时间: 2024-10-08 15:34:45