```cpp
#include<algorithm>
#include<iostream>
using namespace std;
int number[21],s;
char str[30];
int tonum(char ch[]) {
if(str=="one")return 1;
if(str=="two")return 2;
if(str=="three")return 3;
if(str=="four")return 4;
if(str=="five")return 5;
if(str=="six")return 6;
if(str=="seven")return 7;
if(str=="eight")return 8;
if(str=="nine")return 9;
if(str=="ten")return 10;
if(str=="eleven")return 11;
if(str=="twelve")return 12;
if(str=="thirteen")return 13;
if(str=="fourteen")return 14;
if(str=="fifteen")return 15;
if(str=="sixteen")return 16;
if(str=="seventeen")return 17;
if(str=="eighteen")return 18;
if(str=="nineteen")return 19;
if(str=="twenty")return 20;
return -123;
}
int main() {
for(int i=1; i<=6; i++) {
cin>>str;
if(tonum(str)!=-123)
number[++s]=(tonum(str)*tonum(str))%100;
}
sort(number+1,number+1+s);
for(int i=1; i<=s; i++)
printf("%d",number[i]);
return 0;
}
```
by liao @ 2018-09-08 17:24:52
@[liao](/space/show?uid=106791) 字符串比较**不能**用 `==` 。请手写比较函数。
by Prurite @ 2018-09-08 17:27:04
strcmp??
by liao @ 2018-09-08 17:28:33
@[liao](/space/show?uid=106791) 因为字符串的本质是字符数组(即使是用双引号括起来的常量字符串本质上也是),所以你这样比较两个字符串与下面的代码效果无异:
```cpp
int a[10], b[10];
if ( a==b )
// Do something
```
你觉得这样可以吗2333
by Prurite @ 2018-09-08 17:29:11
@[liao](/space/show?uid=106791) 当然 `strcmp` 也行。具体用法我就不啰嗦了,自己查吧。
by Prurite @ 2018-09-08 17:29:45
@[liao](/space/show?uid=106791) 可以
by 2017zc @ 2018-09-08 17:29:53
用string啊。。
string的功能可是很强的
(就是非常非常的慢)
by 星小雨 @ 2018-09-08 17:30:23
好吧
谢谢你们
by liao @ 2018-09-08 17:31:08
```cpp
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int db[30],a[10],cur=0;
int Hash(string s){
long long ans=1313;
const int seek=131;
int temp=s.size();
for(int i=0;i<temp;i++){
if('A'<=s[i]&&s[i]<='Z') s[i]=s[i]-'A'+'a';
ans=(ans-s[i])*seek;
}
return ans&0x3fff;
}
int main(){
db[1]=Hash("one");
db[2]=Hash("two");
db[3]=Hash("three");
db[4]=Hash("four");
db[5]=Hash("five");
db[6]=Hash("six");
db[7]=Hash("seven");
db[8]=Hash("eight");
db[9]=Hash("nine");
db[10]=Hash("ten");
db[11]=Hash("eleven");
db[12]=Hash("twelve");
db[13]=Hash("thirteen");
db[14]=Hash("fourteen");
db[15]=Hash("fifteen");
db[16]=Hash("sixteen");
db[17]=Hash("seventeen");
db[18]=Hash("eighteen");
db[19]=Hash("nineteen");
db[20]=Hash("twenty");
db[21]=Hash("a");
db[22]=Hash("both");
db[23]=Hash("another");
db[24]=Hash("first");
db[25]=Hash("second");
db[26]=Hash("third");
// sort(db+1,db+27);
// for(int i=1;i<=26;i++) printf("%d\n",db[i]);
string t;
for(int i=1;i<=6;i++){
cin>>t;
int temp=Hash(t);
for(int j=1;j<=26;j++)
if(db[j]==temp){
if(j<=20) a[++cur]=j*j%100;
else{
if(j==21||j==23||j==24){ a[++cur]=1;break; }
if(j==22||j==25) { a[++cur]=4;break; }
if(j==26) { a[++cur]=9;break; }
}
// cout<<a[cur]<<" ";
}
}
// cout<<"\n";
// cout<<cur;
if(cur==0){
cout<<0;
return 0;
}
sort(a+1,a+cur+1);。
for(int i=1;i<=cur;i++){
if(a[i]<10&&i!=1) cout<<0<<a[i];
else cout<<a[i];
}
return 0;
}
```
by lzx是个蒟蒻 @ 2018-09-08 17:49:40