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
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 2015浙江省赛的题目其中一题,不是很难。
题意:给出n张选票,算出得票数最多的人的id,如果有2个及以上的人都获得了最多的选票,则输出Nobody。
思路:计数题。设一个结构体,最后按照票数来排序即可。
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std; struct node
{
int id;
int cnt;
}a[]; bool cmp(node a, node b)
{
return a.cnt > b.cnt;
} int main()
{
//freopen("D:\\txt.txt", "r", stdin);
int n;
while (cin >> n)
{
while (n--)
{
memset(a, , sizeof(a));
int t,m;
int maxn = ;
cin >> t;
for (int i = ; i < t; i++)
{
cin >> m;
a[m].id = m;
a[m].cnt++;
}
sort(a, a + , cmp);
if (a[].cnt == a[].cnt) cout << "Nobody" << endl;
else cout << a[].id<<endl;
}
}
}

ZOJ 3869 Ace of Aces的更多相关文章

  1. 水题 ZOJ 3869 Ace of Aces

    题目传送门 水题,找出出现次数最多的数字,若多个输出Nobody //#include <bits/stdc++.h> //using namespace std; #include &l ...

  2. zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 The 12th Zhejiang Provincial ...

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

    Ace of Aces Time Limit: 2 Seconds Memory Limit: 65536 KB There is a mysterious organization called T ...

  4. Ace of Aces

    Description There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the ...

  5. 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(浙江省赛2015)

      Ace of Aces Time Limit: 2 Seconds      Memory Limit: 65536 KB There is a mysterious organization c ...

  6. 【windows 访问控制】十一、C# 实操 对象 System.Security.AccessControl 命名空间

    AccessControl 命名空间 结构图 解说: DirectorySecurity=目录ACLFileSecurity=文件ACLFileSystemAuditRule=目录和文件中SACL中的 ...

  7. ACE的构建(VC++6.0环境)

    ACE的构建(VC++6.0环境)Windows下ACE的构建1. 将ACE-5.5.zip解压到所需的安装目录,此处以E:/为例,解压后形成ACE_wrappers文件夹,因此ACE将会存在于ACE ...

  8. Windows Server 2008及以上系统磁盘无法查看(About UAC and ACE)

    在windows Server2008及以上系統,如果UAC Enabled,ACE列表中不會包含Administrators成員的SID,所以即使你是administrators的成員,也無法訪問D ...

  9. ZOJ People Counting

    第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ  3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...

随机推荐

  1. js 的each()方法遍历对象和数组

    <script src="../lib/jquery-1.8.3.min.js" ></script> <script type="text ...

  2. PAT 1101 Quick Sort[一般上]

    1101 Quick Sort(25 分) There is a classical process named partition in the famous quick sort algorith ...

  3. [LeetCode] 285. Inorder Successor in BST_Medium tag: Inorder Traversal

    Given a binary search tree and a node in it, find the in-order successor of that node in the BST. No ...

  4. js模拟电梯操作

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. python性能分析(一)——使用timeit给你的程序打个表吧

    前言 我们可以通过查看程序核心算法的代码,得知核心算法的渐进上界或者下界,从而大概估计出程序在运行时的效率,但是这并不够直观,也不一定十分靠谱(在整体程序中仍有一些不可忽略的运行细节在估计时被忽略了) ...

  6. EditPlus 4.3.2583 中文版已经发布

    新的版本提升了括号匹配的性能.请点击页面左上角连接下载.

  7. za

    http://www.szjs.gov.cn/bsfw/zdyw_1/zfbz/jgcx/

  8. Python: ValueError: too many values to unpack

    eg1: >>>a,b=(1,2,3) Traceback (most recent call last): File "<stdin>",line ...

  9. 如何合并两个Git仓库

    欢迎和大家交流技术相关问题: 邮箱: jiangxinnju@163.com 博客园地址: http://www.cnblogs.com/jiangxinnju GitHub地址: https://g ...

  10. xmind使用教程思维导图

    xmind使用教程思维导图 开始XMind旅程标记: 仅需2个快捷键 1 点击快捷键 创建同级主题 创建子主题 2 输入 选中主题后, 双击鼠标左键 或 单击空格键, 进入编辑状态. 3 其他内容 您 ...