标签:
6
07101020105 3 15
07101020115 4 5
07101020118 3 15
07101020108 4 5
07101020111 4 5
07101020121 8 10
3 15 07101020105 07101020118
4 5 07101020115 07101020108 07101020111
8 10 07101020121
#include <iostream>
#include <algorithm>
using namespace std;
struct student{
char number[12];
int month;
int day;
}stu[201];
bool compare(student a,student b){
if(a.month<b.month) return true;
else if(a.month==b.month){
if(a.day<b.day) return true;
else return false;
}else return false;
}
int main(){
int n,i,j;
cin>>n;
for(i=0;i<n;i++){
cin>>stu[i].number>>stu[i].month>>stu[i].day;
}
sort(stu,stu+n,compare);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
if(stu[i].month==stu[j].month&&stu[i].day==stu[j].day){
if(i==j){
cout<<stu[i].month<<" "<<stu[i].day<<" "<<stu[i].number;
}
else {
cout<<" "<<stu[j].number;
}
}else{
cout<<endl;
i=j-1;
break;
}
}
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/lchzls/p/5781715.html