代码↓
#include <bits/stdc++.h>
using namespace std;
struct man{
int votes;
int numb;
};
bool cmp(man a, man b){
return a.votes>b.votes;
}
int main(){
int n;
scanf("%d", &n);
man pr[n];
for(int i=1; i<=n; i++){
pr[i-1].numb=i;
scanf("%d",&pr[i-1].votes);
}
sort(pr, pr+n, cmp);
cout<<pr[0].numb<<endl<<pr[0].votes;
return 0;
}
不知道为啥