1 solutions

  • 0
    @ 2023-1-21 16:14:43
    #include<bits/stdc++.h>
    using namespace std;
    int a[1000000],b[1000000],c[1000000];
    bool cmp(int x, int y){
    	return x > y;
    }
    int main()
    {
    	int n;
    	cin >> n;
    	for(int i = 1; i <= n; i++){
    		cin >> a[i];
    	}
    	int m;
    	cin >> m;
    	/*
    	80 50 50 30		成绩
    	1  2  3  4		下标
    	1  2  2  4		排名 
    	*/
    	sort(a+1,a+1+n,cmp);
    	for(int i = 1; i <= n; i++){
    		if(a[i] == m){
    			cout << i;
    			break;
    		}
    	}
    	return 0;
    }
    
    
    
    • 1

    Information

    ID
    791
    Time
    1000ms
    Memory
    32MiB
    Difficulty
    10
    Tags
    # Submissions
    4
    Accepted
    3
    Uploaded By