pta有一个测试点过不去不去
这是网址https://麻烦各位大佬了
程序代码:
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int count=0; char * key[]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"}; char num[1000]; scanf("%s",num); int index=1; int gewei = 0; for(int i=0;num[i]!='\0';i++) { count=count+((int)num[i]-48); if(count/index>0) { gewei++; index *=10; } } for(int i=gewei;i;i--) { int d=count/pow(10,i-1); printf("%s",key[d]); count = count-d*pow(10,i-1); if(count<=0) { printf(""); } else { printf(" "); } } return 0; }
[此贴子已经被作者于2020-3-8 19:39编辑过]