目前已经确定是输入的问题,不知道怎么改。 代码:
#include <bits/stdc++.h>
using namespace std;
int people,temp,j_1,j_2,tempy,tempm,tempd,tel[200005],y[200005],m[200005],d[200005],day[1240];
string name[200005],sex[200005];
int main()
{
cin>>people;
for(int i=0;i<people;i++) {
cin>>name[i]>>sex[i]>>tel[i];
scanf("%d-%d-%d",&tempy,&tempm,&tempd);
y[i]=tempy;
m[i]=tempm;
d[i]=tempd;
}
for(int i=0;i<people;i++){
temp=m[i]*100+d[i];
day[temp]++;
if(day[temp]==2){
j_1=i;
for(int k=0;k<i;k++){
if(m[k]*100+d[k]==temp){
j_2=k;
}
}
cout<<j_2+1<<" "<<name[j_2]<<" "<<sex[j_2]<<" "<<tel[j_2]<<" "<<y[j_2]<<"-"<<m[j_2]<<"-"<<d[j_2]<<"\n";
cout<<j_1+1<<" "<<name[j_1]<<" "<<sex[j_1]<<" "<<tel[j_1]<<" "<<y[j_1]<<"-"<<m[j_1]<<"-"<<d[j_1];
return 0;
}
}
cout<<-1;
return 0;
}