标签:int ret lse sum pat git bsp cst code
1 #include<cstdio> 2 #include<cstring> 3 char str[10][6] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; 4 int main(){ 5 int i = 0, sum = 0, digit[10]; 6 char number[111]; 7 scanf("%s",number); 8 int n = strlen(number); 9 for(int i = 0; i < n; i++) 10 sum += number[i] - ‘0‘; 11 if(number[0] == ‘0‘) 12 printf("zero"); 13 else{ 14 while(sum){ 15 digit[i++] = sum % 10; 16 sum /= 10; 17 } 18 for(int j = i-1; j >= 0; j--){ 19 if(j != i-1) 20 printf(" "); 21 printf("%s",str[digit[j]]); 22 } 23 } 24 return 0; 25 }
标签:int ret lse sum pat git bsp cst code
原文地址:https://www.cnblogs.com/zjsaipplp/p/10415830.html