还没开始做比较呢,就出现问题了。
#include <iostream>
#include <sstream>
//#include <cmath>
using namespace std;
string str(int a){
stringstream st;
st<<a;
string s;
return s;
}
int main(){
// string s="test";
// cout<<s.find("e1")<<" "<<string::npos;
int n,xyz[100];
string a[100];
for(int i=0;i<100;i++){
a[i]=str(i);
if(i<10)
a[i]="0"+a[i];
//cout<<a[i]<<endl;
}
cin>>n;
for(int i=0;i<n;i++){
string b;
cin>>b;
for(int j=0;j<100;j++){
if (b.find(a[j])!=string::npos)
xyz[j]+=1;
}
}
for(int h=0;h<100;h++)
cout<<xyz[h]<<endl;
return 0;
}
我输入
4
YE5777
YB5677
YC8367
YA77B3
他输出
4
4
4
5
4
7
4
4
4
7
4
12
5
12261708
4
12261748
4
-1800082157
32766
4
4
12255236
4
12260828
4
4
4
4
4
12260420
4
4
4
50397190
32766
4
4
419430429
4
7
4
-1800378364
32766
4
4
7
4
12
4
4
4
真的不知道什么毛病谢谢
而且跟网上别人的思路不太一样没找到差不多的