8 solutions

  • 2
    @ 2026-3-18 17:20:35

    题解(我是好人,给我点赞):

    #include<bits/stdc++.h>
    #include<iostream>
    using namespace std;
    int n;
    struct node{
    	int m;
    	int b;
    	string s;
    }p[10000];
    bool cmp(node p1,node p2){
    	if(p1.b>p2.b){
    		return p1>p2;
    	}else{
    		return p2>p1;
    	}
    }
    int main(){
    	cin>>n;
    	for(int i=1;i<=n;i++){
    		cin>>p[i].s>>p[i].b;
    }
    sort(b+n,b+n+1,cmp); 
    	for(int i=1;i<=n;i++){
    		p[i].m=i;
    		cout<<p[i].m<<" "<<p[i].s<<" "<<p[i].b<<" "<<endl;
    }
    return 0;
    }
    
    
    • 1
      @ 2026-3-18 17:24:56

      +1

      • 1
        @ 2026-3-18 17:24:35

        1

        • -1
          @ 2026-3-18 17:18:56

          题解(我是好人,给我点赞): #include<bits/stdc++.h> #include using namespace std; int n; struct node{ int m; int b; string s; }p[10000]; bool cmp(node p1,node p2){ if(p1.b>p2.b){ return p1>p2; }else{ return p2>p1; } } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>p[i].s>>p[i].b; } sort(b+n,b+n+1,cmp); for(int i=1;i<=n;i++){ p[i].m=i; cout<<p[i].m<<" "<<p[i].s<<" "<<p[i].b<<" "<<endl; } return 0; }

          • -2
            @ 2025-12-26 21:52:19

            王浩泽,我给你点差

            • -2
              @ 2025-12-23 18:03:04

              @王浩泽,你能做出来吗

              • -4
                @ 2025-12-23 17:27:11

                你装啥装

                • -9
                  @ 2025-6-6 17:01:24

                  看看看看个蛋

                  • 1

                  Information

                  ID
                  35
                  Time
                  2000ms
                  Memory
                  512MiB
                  Difficulty
                  9
                  Tags
                  # Submissions
                  27
                  Accepted
                  4
                  Uploaded By