2 条题解

  • 0
    @ 2026-1-30 10:48:43
    #include<bits/stdc++.h>
    using namespace std;
    struct student{
    	int id;
    	string name;
    	int zmc;
    	int smc;
    	int jinbu;
    }st[55];
    bool cmp(student a, student b){
    	if(a.jinbu==b.jinbu)
    		return a.id<b.id;
    	else
    		return a.jinbu>b.jinbu;
    }
    int main(){ //进步最大的同学
    	int n;
    	cin>>n;
    	for(int i=0;i<n;i++) {//名字 
    		cin>>st[i].name;
    		st[i].id=i+1; 
    	}
    	for(int i=0;i<n;i++) //当前名次 
    		cin>>st[i].zmc;
    	for(int i=0;i<n;i++){//上次名次 
    		cin>>st[i].smc;
    		st[i].jinbu=st[i].smc-st[i].zmc;
    	}
    	sort(st,st+n,cmp);
    	for(int i=0;i<n;i++){
    		if(st[i].jinbu==st[0].jinbu)
    			cout<<st[i].id<<" "<<st[i].name<<endl;
    	}
    	return 0;
    }
    
    
    
    

    信息

    ID
    1175
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    (无)
    递交数
    20
    已通过
    16
    上传者