coyangjr @ 2018-02-03 17:39:47
贡献下我的代码
#include <bits/stdc++.h>
using namespace std;
string letter[7];
int passwd[7];
int n=1;
long long pass;
int main()
{
for (int i=1;i<=6;i++)
{
cin >> letter[i];
for (int j=0;j<letter[i].length();j++) if(letter[i][j]>='A'&&letter[i][j]<='Z') letter[i][j]=letter[i][j]+32;
}
for (int i=1;i<=6;i++)//转换数字
{
if (letter[i]=="one"){
passwd[n]=1;
n++;
}
else if (letter[i]=="two"){
passwd[n]=2;
n++;
}
else if (letter[i]=="three"){
passwd[n]=3;
n++;
}
else if (letter[i]=="four"){
passwd[n]=4;
n++;
}
else if (letter[i]=="five"){
passwd[n]=5;
n++;
}
else if (letter[i]=="six"){
passwd[n]=6;
n++;
}
else if (letter[i]=="seven"){
passwd[n]=7;
n++;
}
else if (letter[i]=="eight"){
passwd[n]=8;
n++;
}
else if (letter[i]=="nine"){
passwd[n]=9;
n++;
}
else if (letter[i]=="ten"){
passwd[n]=10;
n++;
}
else if (letter[i]=="eleven"){
passwd[n]=11;
n++;
}
else if (letter[i]=="twelve"){
passwd[n]=12;
n++;
}
else if (letter[i]=="thirteen"){
passwd[n]=13;
n++;
}
else if (letter[i]=="fourteen"){
passwd[n]=14;
n++;
}
else if (letter[i]=="fifteen"){
passwd[n]=15;
n++;
}
else if (letter[i]=="sixteen"){
passwd[n]=16;
n++;
}
else if (letter[i]=="seventeen"){
passwd[n]=17;
n++;
}
else if (letter[i]=="eghiteen"){
passwd[n]=18;
n++;
}
else if (letter[i]=="nineteen"){
passwd[n]=19;
n++;
}
else if (letter[i]=="twenty"){
passwd[n]=20;
n++;
}
else if (letter[i]=="a"){
passwd[n]=1;
n++;
}
else if (letter[i]=="both"){
passwd[n]=2;
n++;
}
else if (letter[i]=="first"){
passwd[n]=1;
n++;
}
else if (letter[i]=="second"){
passwd[n]=2;
n++;
}
else if (letter[i]=="third"){
passwd[n]=3;
n++;
}
}
n=n-1;
for (int i=1;i<=n;i++) passwd[i]=passwd[i]*passwd[i]%100;
//cout << "n:"<<n<<endl;
sort (passwd+1,passwd+n+1);
//cout <<passwd[1]<<" "<<passwd[2]<<" "<<passwd[3]<<" "<<passwd[4]<<" "<<passwd[5]<<" "<<passwd[6]<<endl;
for (int i=1;i<=n;i++) pass=pass*100+passwd[i];
cout <<pass<<endl;
return 0;
}
写完后真的就哇(WA)的一声快崩了。。。
by 真·五河士道 @ 2018-02-06 16:58:58
你的zero判断呢 如果有零的话,你的程序是不可能通过的