Ace of Aces

Time Limit: 2 Seconds Memory Limit: 65536 KB

There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the deep universe that we humans have not discovered yet. This year, the TSAB decided to elect an outstanding member from its elite troops. The elected guy will be honored with the title of “Ace of Aces”.

After voting, the TSAB received N valid tickets. On each ticket, there is a number Ai denoting the ID of a candidate. The candidate with the most tickets nominated will be elected as the “Ace of Aces”. If there are two or more candidates have the same number of nominations, no one will win.

Please write program to help TSAB determine who will be the “Ace of Aces”.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

The first line contains an integer N (1 <= N <= 1000). The next line contains N integers Ai (1 <= Ai <= 1000).

Output

For each test case, output the ID of the candidate who will be honored with “Ace of Aces”. If no one win the election, output “Nobody” (without quotes) instead.

Sample Input

3

5

2 2 2 1 1

5

1 1 2 2 3

1

998

Sample Output

2

Nobody

998

#include <bits/stdc++.h>

using namespace std;

struct node
{
int sum;
int pos;
}po[1100]; bool cmp(node a,node b)
{
return a.sum>b.sum;
} int main()
{
int t,n,i,a;
bool flag;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
flag=true;
memset(po,0,sizeof(po));
for(i=0; i<n; i++)
{
scanf("%d",&a);
po[a].sum++;
po[a].pos=a; }
sort(po,po+1001,cmp);
for(i=1 ;i<=1000 ;i++)
{
if(po[i].sum==po[0].sum)
{
flag=false;
break;
} }
//cout<<po[0].pos<<endl;
if(flag)
{
printf("%d\n",po[0].pos);
}
else
{
printf("Nobody\n");
}
}
return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

第十二届浙江省大学生程序设计大赛-Ace of Aces 分类: 比赛 2015-06-26 14:25 12人阅读 评论(0) 收藏的更多相关文章

  1. 第十二届浙江省大学生程序设计大赛-Capture the Flag 分类: 比赛 2015-06-26 14:35 10人阅读 评论(0) 收藏

    Capture the Flag Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge In computer security, Ca ...

  2. 第十二届浙江省大学生程序设计大赛-May Day Holiday 分类: 比赛 2015-06-26 14:33 10人阅读 评论(0) 收藏

    May Day Holiday Time Limit: 2 Seconds Memory Limit: 65536 KB As a university advocating self-learnin ...

  3. 第十二届浙江省大学生程序设计大赛-Beauty of Array 分类: 比赛 2015-06-26 14:27 12人阅读 评论(0) 收藏

    Beauty of Array Time Limit: 2 Seconds Memory Limit: 65536 KB Edward has an array A with N integers. ...

  4. 第十二届浙江省大学生程序设计大赛-Demacia of the Ancients 分类: 比赛 2015-06-26 14:39 30人阅读 评论(0) 收藏

    Demacia of the Ancients Time Limit: 2 Seconds Memory Limit: 65536 KB There is a popular multiplayer ...

  5. 第十二届浙江省大学生程序设计大赛-Lunch Time 分类: 比赛 2015-06-26 14:30 5人阅读 评论(0) 收藏

    Lunch Time Time Limit: 2 Seconds Memory Limit: 65536 KB The 999th Zhejiang Provincial Collegiate Pro ...

  6. 第十二届浙江省大学生程序设计大赛-Team Formation 分类: 比赛 2015-06-26 14:22 50人阅读 评论(0) 收藏

    Team Formation Time Limit: 3 Seconds Memory Limit: 131072 KB For an upcoming programming contest, Ed ...

  7. 团体程序设计天梯赛L2-001 紧急救援 2017-03-22 17:25 93人阅读 评论(0) 收藏

    L2-001. 紧急救援 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 作为一个城市的应急救援队伍的负责人,你有一张特殊的全国 ...

  8. Android 应用中十大常见 UX 错误 分类: H1_ANDROID 2013-09-21 13:59 404人阅读 评论(0) 收藏

    转载自:http://www.apkbus.com/android-5661-1.html 摘要: Android 开发者关系团队每天都会试用无数的 App 或者受到无数的开发者发来的请求评测的 Ap ...

  9. 2012年"浪潮杯"山东省第三届ACM大学生程序设计竞赛--n a^o7 ! 分类: 比赛 2015-06-09 17:16 14人阅读 评论(0) 收藏

    n a^o7 ! Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 All brave and intelligent fighte ...

随机推荐

  1. XMPP协议介绍

    一.xmpp协议工作原理 二.XMPP地址模式 三.xmpp消息格式 xmpp xml包括三个元素,message,presence,iq,也翻译做三种节. 在'jabber:client'和'jab ...

  2. PostgreSQL pg_dump pg_dumpall and restore

    pg_dump dumps a database as a text file or to other formats. Usage: pg_dump [OPTION]... [DBNAME] Gen ...

  3. poj 1176 Party Lamps

    http://poj.org/problem?id=1176 Party Lamps Time Limit: 1000MS   Memory Limit: 10000K Total Submissio ...

  4. Cortex-R5

    TCM:Tightly Coupled Memory,连接到RAM等memory中,但是CPU读写速度很快. ECC:Error Checking and Correction PMU:Perform ...

  5. scrum站立会议------10.20

    小组名称:nice! 小组成员:李权 于淼 杨柳 刘芳芳 项目内容:约跑app(约吧--暂定) 1.任务进度 2.燃尽图

  6. SSO系统的分析与架构

    随着公司子系统越来越多,一直以来使用ucenter的同步登录方式的性能以及效率问题显得越来越大,重新构建一个SSO系统显得势在必行. 通过google搜索关于SSO单点登录文章,发现以下文章关于新浪微 ...

  7. linux下的网络配置

    临时生效的命令: 设置静态ip: ip addr add 192.168.1.2/24 dev eth0 设置网关: ip route add default via 192.168.1.1 启动某个 ...

  8. 《zw版·Halcon-delphi系列原创教程》cgal与opencv,Halcon

    <zw版·Halcon-delphi系列原创教程>cgal与opencv,Halcon opencv作为少有的专业开源图像软件,虽然功能,特别是几何计算方面,不如Halcon,不过因为开源 ...

  9. php使用过滤器filter_var轻松验证邮箱url和ip地址等

    以前使用php的时候还不知道有过滤器filter这玩意,那时候判断邮箱.url和ip地址格式是否符合都是用正则表达式.后来随着使用的逐渐深入,才知道在php中也可以使用内置的函数库过滤器filter来 ...

  10. ASP.NET MVC API 路由生成规则

    我们都知道调用ASP.NET MVC的某些API函数(诸如:Url.Action.RedirectToAction等)可以生成URL,ASP.NET MVC会根据调用API函数时传入的参数去匹配系统定 ...