2 条题解

  • 0
    @ 2024-1-12 15:24:13
    #include<bits/stdc++.h>
    using namespace std;
    struct student{
    	int d;
    	int s;
    }stu[100];
    bool cmp(student a,student b){
    	if(a.s==b.s)
    	return a.d<b.d;
    	else
    		return a.s>b.s;
    }
    int main(){
    	int n;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		cin>>stu[i].d>>stu[i].s;
    	} 
    	sort(stu,stu+n,cmp);
    	for(int i=0;i<3;i++)
    		cout<<stu[i].d<<" "<<stu[i].s<<endl;
    	return 0;
    }
    
    • 0
      @ 2023-4-13 9:32:13
      • 1

      蓝桥杯编程等级考试C++16级_成绩排序

      信息

      ID
      565
      时间
      1000ms
      内存
      256MiB
      难度
      8
      标签
      递交数
      12
      已通过
      10
      上传者