http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493

                        The 12th Zhejiang Provincial Collegiate Programming Contest - A

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 分析:
这道题应该是这次浙江省acm省赛的签到题了.
就是比较整数数组元素出现次数最多的一个,如果有多个 输出 Nobody AC代码:
 #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <iomanip>
#include <vector>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#pragma warning(disable:4786) using namespace std; const int INF = 0x3f3f3f3f;
const int MAX = + ;
const double eps = 1e-;
const double PI = acos(-1.0); int a[MAX]; int main()
{
int T;
while(~scanf("%d",&T))
{
while(T --)
{
memset(a , , sizeof(a));
int ma = -INF , i , temp;
int n;
cin >> n;
while(n --)
{
scanf("%d",&temp);
a[temp] ++;
ma = max(ma , temp);
}
int MA = -INF;
int ans = ;
for( i = ;i <= ma;i ++)
{
if(MA < a[i])
{
MA = a[i];
ans = i;
}
}
int ans1 = ;
for(i = ;i <= ma;i ++)
if(MA == a[i])
ans1 ++;
if(ans1 == )
cout << ans << endl;
else
cout << "Nobody" << endl;
}
}
return ;
}

zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces的更多相关文章

  1. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag

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

  2. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Team Formation

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

  3. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Beauty of Array

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

  4. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Lunch Time

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

  5. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak

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

  6. zoj The 12th Zhejiang Provincial Collegiate Programming Contest May Day Holiday

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

  7. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients

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

  8. 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第二部分)

    Floor Function Time Limit: 10 Seconds      Memory Limit: 65536 KB a, b, c and d are all positive int ...

  9. 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 ...

随机推荐

  1. Flink DataSet API Programming Guide

     https://ci.apache.org/projects/flink/flink-docs-release-0.10/apis/programming_guide.html   Example ...

  2. ajax+jsp自动刷新

    通过 AJAX,JavaScript 可使用 JavaScript 的 XMLHttpRequest 对象来直接与服务器进行通信.通过这个对象, JavaScript 可在不重载页面的情况与 Web ...

  3. Android之Fragment学习笔记①

    Android Fragment完全解析,关于碎片你所需知道的一切 一. 什么是FragmentFragment(碎片)就是小型的Activity,它是在Android3.0时出现的.Fragment ...

  4. 【转】Unity3D中Layers和LayerMask解析

    http://blog.csdn.net/yupu56/article/details/50441151 Unity中是用int32来表示32个Layer层.int32表示二进制一共有32位(0-31 ...

  5. 【No.4 Ionic】修改 cordova 插件

    在使用 cordova 过程 使用的插件 有可能不能满足个人需求,就需要修改,下面就直接说说步骤 插件结构 我用 cordova-plugin-inappbrowser 插件 讲解 在目录中有个 sr ...

  6. mysql import data slow solution---overview information

      1 SELECT SUM(DATA_LENGTH)+SUM(INDEX_LENGTH) FROM information_schema.tables WHERE TABLE_SCHEMA='dat ...

  7. Python 与 meta programming

    meta programming: 编写能改变语言语法特性或者运行时特性的程序 Meta- 这个前缀在希腊语中的本意是「在…后,越过…的」,类似于拉丁语的 post-,比如 metaphysics 就 ...

  8. MongoDB创建用户

    1.在创建用户之前,我们首先应该启动mongodb的用户验证功能,否则建立用户是没有意义的! 2.使用 //这个123用户拥有test1数据库的数据库管理员权限,拥有test2数据库的读取权限 db. ...

  9. mongoDB 安装配置

    1. 配置文件: 建立配置文件 :mongodb.conf dbpath=D:\mongoDb\data\db #配置数据库目录路径,预先手动创建db目录 logpath=D:\mongoDb\dat ...

  10. House Building---hdu5538(求表面积水题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5538 题意:有一个三维的图形,先给出平面图是n*m的矩形,每个位置都有不同个数的方块,a[i][j]代 ...