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. 《30天自制操作系统》02_day_学习笔记

    helloos3: helloos.nas的解释在P29中 接下来课本讲了一些汇编语言的知识,便于理解这个汇编文件helloos4: 讲解在P41 helloos.nas后半部分去掉就成了ipl.as ...

  2. codeforces343A A. Rational Resistance

    http://http://codeforces.com/problemset/problem/343/A A. Rational Resistance time limit per test 1 s ...

  3. hduoj 4706 Children&#39;s Day 2013 ACM/ICPC Asia Regional Online —— Warmup

    http://acm.hdu.edu.cn/showproblem.php?pid=4706 Children's Day Time Limit: 2000/1000 MS (Java/Others) ...

  4. Java基础(9):Java生成随机数一定范围内的数的一个典型例子

    题目:编写一个JAVA程序,创建指定长度的 int 型数组,并生成 100 以内随机数为数组中的每个元素赋值,然后输出数组 note: 通过 (int)(Math.random() * 100) 生成 ...

  5. UML: 状态机图

    摘自http://www.umlonline.org/school/viewthread.php?tid=39 活动图将流程分解为一个一个的活动,通过活动的先后顺序来展示流程:而状态机图从某个物品的状 ...

  6. SharedPreferences 轻型的数据存储方式

    //初始化,(名字,隐私或公开) SharedPreferences openTimes=getSharedPreferences("openTimes",0); //提交保存数据 ...

  7. CCF真题之相反数

    201403-1 问题描述 有 N 个非零且各不相同的整数.请你编一个程序求出它们中有多少对相反数(a 和 -a 为一对相反数). 输入格式 第一行包含一个正整数 N.(1 ≤ N ≤ 500).   ...

  8. Android设计模式---观察者模式小demo(一)

    1,今天刚好看到了设计模式这一块来,而观察者模式是我一直想总结的,先来看看观察者模式的简单的定义吧 "当一个对象改变时,他的所有依赖者都会受到通知,并自动更新." 一般我们项目中就 ...

  9. 数据可视化工具zeppelin安装

    介绍 zeppelin主要有以下功能 数据提取 数据发现 数据分析 数据可视化 目前版本(0.5-0.6)之前支持的数据搜索引擎有如下 安装 环境 centOS 6.6 编译准备工作 sudo yum ...

  10. ansible自动化运维工具的安装与使用

    运行环境 centOS6.6 ansible ansible的功能还是比较多的,博主只用它在集群上进行批量部署软件和维护的功能,其他不多做研究,有需要的话这篇文章会慢慢补充. ansible特点 轻量 ...