求助

P1603 斯诺登的密码

3346962731SUN @ 2019-01-06 20:46:15

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 "}; int a[30]={0,1,4,9,16,25,36,49,64,81,00,21,44,69,96,25,56,89,24,61,0,1,4,1,1,4,9}; int main() { int b[10],t=1; string ss; getline(cin,ss); ss=" "+ss; ss=ss.insert(ss.size()-1," "); for(int i=0;i<=27;i++) if(ss.find(s[i])!=string::npos) b[t++]=a[i]; if(t>0) { sort(b+1,b+t+1); int i=1; while(b[i]==0) i++; cout<<b[i]; for(int j=i+1;j<=t;j++) if(b[j]<10) cout<<0<<b[j]; else cout<<b[j]; } else cout<<0; return 0; }


by 冷蕴LengYun @ 2019-01-07 23:26:06

希望更丰富的展现?使用Markdown


|