zl程序教程

您现在的位置是:首页 >  其他

当前栏目

1005 Spell It Right (20 分)【难度: 简单 / 知识点: 模拟】

IT知识点模拟 简单 20 难度 right 1005
2023-09-11 14:15:52 时间

在这里插入图片描述
https://pintia.cn/problem-sets/994805342720868352/problems/994805519074574336

#include<bits/stdc++.h>
using namespace std;
int sum;
string a[15]={"zero","one","two","three","four","five","six","seven","eight","nine"};
int main(void)
{
	string s; cin>>s;
	for(int i=0;i<s.size();i++) sum+=s[i]-'0';
	s=to_string(sum);
	for(int i=0;i<s.size();i++)
	{
		if(i) cout<<" ";
		cout<<a[s[i]-'0'];
	}
	return 0;
}