megadeth @ 2019-04-13 17:03:02
#include<bits/stdc++.h>
using namespace std;
string s[27]={"zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty","a","both","another","first","second","third"};
struct arr
{
int a;
int b;
}a[100];
bool cmp(arr x,arr y)
{
if(x.b==y.b)return x.a<y.a;
return x.b<y.b;
}
int main()
{
string s1;
int k=0,i;
for(int i=0;i<6;i++)
{
cin>>s1;
if(i==5)
s1.erase(s1.length()-1,1);
for(int j=0;j<=26;j++)
if(s1==s[j])
{
int l=j;
if(j==21||j==23||j==24)
l=1;
if(j==22j==25)
l=2;
if(j==26)
l=3;
int n=l*l;
n%=100;
a[k].a=n%10;
a[k].b=n/10;
k++;
}
}
sort(a,a+k,cmp);
int c;
for(i=0;i<k;i++)
if(a[i].b!=0)
{
c=0;
break;
}
else if(a[i].a!=0)
{
c=1;
break;
}
if(c==0)cout<<a[i].b<<a[i].a;
else if(c==1) cout<<a[i].a;
if(i==k)
{
cout<<"0";
return 0;
}
for(i=i+1;i<k;i++)
{
cout<<a[i].b<<a[i].a;
}
return 0;
}
输入Chen Junao is no so clever . 输出 0
by Strong_Jelly @ 2019-04-13 17:16:51
咳咳,大佬在吗???
by Strong_Jelly @ 2019-04-13 17:17:10
在我再回复
by megadeth @ 2019-04-20 14:16:40
@神兵qqq1112 在大佬
by 越羽 @ 2019-05-07 13:27:46
你下一下测试点,那个测试点是句子中没有数字单词,直接特判出0就好了;