2 solutions

  • 1
    @ 2025-7-12 11:05:17
    using namespace std;
    int n;
    long long sum=0,maxx=-100;
    string ss;
    
    struct s{
    	string name;
    	int q;
    	int b;
    	char x;
    	char g;
    	int s=0;
    	int f;
    	int w;
    }a[105];
    
    int main(){
        cin>>n;
        for(int i=1;i<=n;i++){
        	cin>>a[i].name>>a[i].q>>a[i].b>>a[i].g>>a[i].x>>a[i].f;
        	a[i].w=i;
    	}
    	for(int i=1;i<=n;i++){
    		
        	if(a[i].g=='Y'&&a[i].b>80){
        		a[i].s+=850;
    		}        
    		if(a[i].q>80&&a[i].f>=1){
    			a[i].s+=8000;
    		}
    		if(a[i].q>85&&a[i].b>80){
    			a[i].s+=4000;
    		}
    		if(a[i].q>90){
    			a[i].s+=2000;
    		}
    		if(a[i].x=='Y'&&a[i].q>85){
    			a[i].s+=1000;
    		}
    		if(a[i].s>maxx){
    			maxx=a[i].s;
    			ss=a[i].name;
    		}
    	}
    	for(int i=1;i<=n;i++){
        	sum+=a[i].s; 
    	}
    	
    	cout<<ss<<endl<<maxx<<endl<<sum;
        return 0;
    }
    • 0
      @ 2025-3-30 21:05:57
      #include<bits/stdc++.h>
      using namespace std;
      int n;
      long long tt;
      struct node{
      	string name;
      	int last, clas;
      	char guan, west;
      	int talk;
      	int tot; 
      	int num;
      }st[100005];
      bool cmp(node a, node b){
      	if(a.tot!=b.tot){
      		return a.tot>b.tot;
      	}
      	return a.num<b.num;
      }
      int main(){
      	cin>>n;
      	for(int i=0;i<n;i++){
      		cin>>st[i].name>>st[i].last>>st[i].clas>>st[i].guan;
      		cin>>st[i].west>>st[i].talk;
      		st[i].num=i;
      		if(st[i].last>80&&st[i].talk>0){
      			st[i].tot+=8000;
      			tt+=8000;
      		}
      		if(st[i].last>85&&st[i].clas>80){
      			st[i].tot+=4000;
      			tt+=4000;
      		}
      		if(st[i].last>90){
      			st[i].tot+=2000;
      			tt+=2000;
      		}
      		if(st[i].last>85&&st[i].west=='Y'){
      			st[i].tot+=1000;
      			tt+=1000;
      		}
      		if(st[i].clas>80&&st[i].guan=='Y'){
      			st[i].tot+=850;
      			tt+=850;
      		}
      	}
      	sort(st, st+n, cmp);
      	cout<<st[0].name<<"\n";
      	cout<<st[0].tot<<"\n";
      	cout<<tt;
      }
      
      • 1

      Information

      ID
      5109
      Time
      1000ms
      Memory
      125MiB
      Difficulty
      3
      Tags
      # Submissions
      81
      Accepted
      53
      Uploaded By