Question

  • 报送日期不一致的,则日期较近的在上,日期较久远的在下;
  • 报送日期一致体温不一致的,则体温高的在上,体温低的在下;
  • 报送日期和体温都一致的,则学号小的在上,学号大的在下。

    Solution

    结构体+自定义排序

    Code

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 5e5 + 5;

struct stu{
    int x,y;
    double z;
    bool operator < (const stu &T){
        if(x!=T.x) return x>T.x;
        else if(z!=T.z) return z>T.z;
        else return y<T.y;
    }
}a[N];

int main(){
    int n;scanf("%d",&n);
    int m=0;
    for(int i=1;i<=n;i++){
        scanf("%d%d%lf",&a[i].x,&a[i].y,&a[i].z);
        if(a[i].z>=38.00) m++;
    }
    sort(a+1,a+1+n);
    cout<<m<<'\n';
    for(int i=1;i<=n;i++) if(a[i].z>=38.00) printf("%d %d %.1f\n",a[i].x,a[i].y,a[i].z);
    return 0;
}