zoj 3869 Ace of Aces

zoj 3869 Ace of Aces,第1张

zoj 3869 Ace of Aces
#include <iostream>#include <stdio.h>#include <string.h>#include <stack>#include <queue>#include <map>#include <set>#include <vector>#include <math.h>#include <algorithm>using namespace std;#define ls 2*i#define rs 2*i+1#define up(i,x,y) for(i=x;i<=y;i++)#define down(i,x,y) for(i=x;i>=y;i--)#define mem(a,x) memset(a,x,sizeof(a))#define w(a) while(a)#define LL long longconst double pi = acos(-1.0);#define Len 20005#define mod 19999997const int INF = 0x3f3f3f3f;int t,n,a,maxn,flag;struct node{    int cnt,id;}hsh[1005];int cmp(node a,node b){    return a.cnt<b.cnt;};int main(){    int i;    scanf("%d",&t);    w(t--)    {        scanf("%d",&n);        mem(hsh,0);        up(i,0,n-1)        { scanf("%d",&a); hsh[a].id = a; hsh[a].cnt++;        }        sort(hsh,hsh+1001,cmp);        if(hsh[1000].cnt==hsh[999].cnt) printf("Nobodyn");        else printf("%dn",hsh[1000].id);    }    return 0;}

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4925643.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-13

发表评论

登录后才能评论

评论列表(0条)

    保存