1005 Spell It Right - 模擬
阿新 • • 發佈:2018-11-09
程式碼如下:
#include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<queue> #include<cmath> #include<set> #include<sstream> #define ll long long using namespace std; const int N=105,INF=0x3f3f3f3f; string tra[12]={"zero","one","two","three","four","five","six","seven","eight","nine"}; int main(){ string s,s1; ios::sync_with_stdio(false); cin>>s; int ans=0; for(int i=0;i<s.length();i++){ ans+=(s[i]-'0'); } stringstream ss; ss<<ans; ss>>s1; cout<<tra[s1[0]-'0']; for(int i=1;i<s1.length();i++){ cout<<" "<<tra[s1[i]-'0']; } cout<<endl; }