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. PG sys function

    The System Catalogs of PostgreSQLscott=# \dS List of relations Schema | Name | Type | Owner -------- ...

  2. Lintcode: Matrix Zigzag Traversal

    Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in ZigZag-or ...

  3. SQL 数据库 连接查询 变量、if else、while

    一.连接查询:通过连接运算符可以实现多个表查询. 连接是关系数据库模型的主要特点,也是它区别于其它类型数据库管理系统的一个标志. 常用的两个链接运算符: 1.join   on(左右连接) 2.uni ...

  4. JS小练习 留言功能

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  5. spring 官方下载地址

    SPRING官方网站改版后,建议都是通过Maven和Gradle下载,对不使用Maven和Gradle开发项目的,下载就非常麻烦. 下给出Spring Framework jar官方直接下载路径: h ...

  6. 树形DP+贪心(乱搞)(HDU4714)

    题意:给出一个树形图,要求把该树形成一个环最少的步骤(断开一条边和形成一条边都需一步) 分析:很明显,要想把树形成一个环,就要先把其分裂成m条子链之后把子链形成环需要的步骤是2*m+1,所以只需要m最 ...

  7. java使用json将HashMap转化成javabean小例子

    import java.util.HashMap; import java.util.Iterator; import java.util.Map; import net.sf.json.JSONOb ...

  8. NOIP200902分数线划定

    NOIP200902分数线划定 描述 世博会志愿者的选拔工作正在 A 市如火如荼的进行.为了选拔最合适的人才,A 市对所有报名的选手进行了笔试,笔试分数达到面试分数线的选手方可进入面试.面试分数线根据 ...

  9. IE7/8浏览器都不能显示PNG格式图片

    方法一:重新注册pngfilt.dll文件.这个方法是PNG格式开发商官方网站上的推荐方法之一,抱着试试的想法按网站推荐的方法试了,一试成功.方法如下:使用 开始->运行,在运行输入框中输入 “ ...

  10. EXCEL 删除重复项并保留最大最小值

    自定义排序 框选需要主次排序的区域 开始—排序和筛选—自定义排序 添加筛选条件 若要获取最小值则次要关键字选择升序 排序后的数据 删除重复项 数据—删除重复项 选择要删除的列 删除A列的重复项后,B列 ...