Ace of Aces

Description

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<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int a[1005];
int f[1005];

int main()
{
    int t,n,x,flag;
    int maxx;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        memset(f,0,sizeof(f));
        maxx=-1;flag=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            f[a[i]]++;
        }
        for(int i=0;i<1004;i++)
        {
            if(f[a[i]]>maxx)
            {
                maxx=f[a[i]];
                x=a[i];
            }
        }
        for(int i=0;i<1004;i++)
            if(f[a[i]]==maxx&&a[i]!=x)
            flag++;
        if(flag>0)
            printf("Nobody\n");
        else
            printf("%d\n",x);
    }
    return 0;
}

时间: 2025-01-09 13:35:17

Ace of Aces的相关文章

A - Ace of Aces——ZOJ

A - Ace of Aces Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Description There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the deep universe that we humans have not discov

ZOJ-3869

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 h

2015浙江省赛

ZOJ 3872 :Beauty of Array 对于每个数,计算这个数被累加的次数.找到这个数左边这个数出现的地方,在这之间的所有数的数量*这个数后面的数的数量,即为这个数被计算的次数 <code class="hljs cpp has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pr

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

ACE的构建(VC++6.0环境)Windows下ACE的构建1. 将ACE-5.5.zip解压到所需的安装目录,此处以E:/为例,解压后形成ACE_wrappers文件夹,因此ACE将会存在于ACE_wrappers/ace目录中.ACE_ROOT=E:/ACE_wrappers.2. 在系统中新建ACE_ROOT环境变量,值设为 E:/ACE_wrappers.具体设置为:我的电脑->属性->高级->环境变量->新建3. 在E:/ACE_wrappers/ace目录中创建一个头

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

在windows Server2008及以上系統,如果UAC Enabled,ACE列表中不會包含Administrators成員的SID,所以即使你是administrators的成員,也無法訪問D盤! 解决方法参考如下文章: Changes to tokens When a user who is a member of the Administrators group in Windows® XP or Windows Server 2003 logs on to a computer,

jeecg 3.5.2 新版本4种首页风格 【经典风格,shortcut风格,ACE bootstrap风格,云桌面风格】

[1]经典风格: [2]Shortcut风格: [3]ACE bootsrap风格: [4]云桌面风格: [5]自定义图表 [6].系统监控

【阿里云产品公测】以开发者角度看ACE服务『ACE应用构建指南』

?;ZnD(4?   评测介绍 1V-sibE   j|LOg 评测产品: 云引擎ACE服务 开发语言: PHP 评测人: mr_wid 评测时间: 2014年10月13日-19日 XV1XzG#C   .>p.k*vU   评测概要 9]:F!d/   fYlqaO4[   非常有幸能够申请到ACE的公测资格, 在本篇评测中, 笔者将以一个开发者的角度来对云引擎ACE服务进行介绍与使用.在本篇评测中, 您将看到: ACE能够做些什么 ACE应用的创建与发布 应用的配置与调试 ACE扩展服务的使

改造 Ace Admin 模板的 ace_tree 组件的 folderSelect 样式

*注:我用的Ace Admin版本为1.3.4 Ace Admin 是一个轻量,功能丰富,HTML5.响应式.支持手机及平板电脑上浏览的优秀管理后台模板. 关于tree的使用,html文件夹下treeview.html给了静态数据的例子,examples下treeview.html给了动态PHP语言的例子. 但是exmaple下的那个treeview,当参数“folderSelect=true”时:如图: 当点开 后,如图: 都不能再收起来,而我想改造成 folder点击选择,也象item样式一

5 ACE acceptor connector Proactor异步框架

ACE_Acceptor_Connector框架 完成accpet操作 [email protected]:~/ace/AceAcceptorConnector$ cat echo_server.cpp  #include <ace/Svc_Handler.h> #include <ace/SOCK_Stream.h> #include <ace/SOCK_Acceptor.h> #include <ace/Acceptor.h> class Accepto