patB1002 写出这个数

#include <iostream>
#include <cstring> 
#include <algorithm>
using namespace std;
const int maxn=10000001;
int buf[maxn];
int num[100];
int numsize=0;
void change(int x){
do{
num[numsize++]=x%10;
x/=10;
}while(x!=0);
}
string map[10]={"ling","yi","er","san","si","wu","liu","qi","ba","jiu"};
int main(int argc, char** argv) {
string str;
cin>>str; 
// cout<<str;
int count=0;
for(string::iterator it=str.begin();it!=str.end();it++) count+=*it-'0';
change(count);
reverse(num,num+numsize);
for(int i=0;i<numsize;i++){
cout<<map[num[i]];
if(i!=numsize-1) putchar(' ');
}
return 0;

}


阅读更多

没有更多推荐了,返回首页