有 条信息
形如
要求你从中筛选出
的,然后按照
为第一关键字(降序),
为第二关键字 (降序) ,
为第三关键字 (升序) 排序并输出。
按题意模拟即可。排序可以用
复杂度
#include <bits/stdc++.h>
using namespace std;
struct data{
int date; double tem; int code;
inline void print(){
cout << date << ' ';
cout << code << ' ';
cout << fixed << setprecision(1) << tem << '\n';
}
inline bool operator < (const data w) const{
if (date != w.date) return date > w.date;
if (abs(tem-w.tem) > 1e-3) return tem > w.tem;
return code < w.code;
}
}a[1000];
int n,m;
int main(){
int dd; double tt;int cc;
m = 0; cin >> n;
while (n--){
cin >> dd >> cc >> tt;
if (tt < 38) continue;
++m;
a[m].date = dd;
a[m].code = cc;
a[m].tem = tt;
}
cout << m << '\n';
sort(a+1,a+m+1);
for (int i = 1; i <= m; ++i) a[i].print();
return 0;
} 
京公网安备 11010502036488号