第十二届浙江省大学生程序设计大赛-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 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) 收藏的更多相关文章
- 第十二届浙江省大学生程序设计大赛-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 ...
- 第十二届浙江省大学生程序设计大赛-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 ...
- 第十二届浙江省大学生程序设计大赛-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. ...
- 第十二届浙江省大学生程序设计大赛-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 ...
- 第十二届浙江省大学生程序设计大赛-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 ...
- 第十二届浙江省大学生程序设计大赛-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 ...
- 团体程序设计天梯赛L2-001 紧急救援 2017-03-22 17:25 93人阅读 评论(0) 收藏
L2-001. 紧急救援 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 作为一个城市的应急救援队伍的负责人,你有一张特殊的全国 ...
- Android 应用中十大常见 UX 错误 分类: H1_ANDROID 2013-09-21 13:59 404人阅读 评论(0) 收藏
转载自:http://www.apkbus.com/android-5661-1.html 摘要: Android 开发者关系团队每天都会试用无数的 App 或者受到无数的开发者发来的请求评测的 Ap ...
- 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 ...
随机推荐
- Codeforce Round #220 Div2
这场气场太大,居然一个题不会! 所以没交! 赛后发现 A:陷阱多- -!不要超过上下界,可以上去再下来! B:不会做! C:自己想太多- -!
- UML: 活动图
摘自http://www.umlonline.org/school/thread-36-1-1.html 活动图和流程图很类似,我们看看一个流程图的例子: 活动图是用来描述流程的一种图,它与流程图的不 ...
- MyEclipse 下 Tomcat启动变慢如何解决
MyEclipse 下 Tomcat启动变慢如何解决 项目使用debug启动有时候会突然变得非常慢.不但启动慢,启动之后连打开项目页面也很慢,是日常的4,5倍.可以有下面的几种解决方法: 1. ...
- yii中sphinx,Ajax搜索分页
效果图: 控制器: <?phpnamespace backend\controllers; use Yii;use yii\web\Controller;use yii\data\Paginat ...
- springday02-go2
1.复制xml文件到container.auto下2.Waiter类实现构造函数3.Bar类中Waiter作为其成员变量,并实现其get/set方法,有参和无参构造器,toString方法4.分别修改 ...
- ADO.NET中的TransactionScope何时需要启用MSTDC(分布式事务管理)
我们知道在ADO.NET中可以用TransactionScope来将多个SqlConnection(多个数据库连接)执行的Sql语句放入一个事物中提交或取消,但是使用TransactionScope的 ...
- 菜鸟,大牛和教主三者的区别(转自hzwer)
菜鸟,大牛和教主,三者的区别 对菜鸟来说题目有三种:会算法且能AC的,会算法但不能AC的,不会做的 对大牛来说题目有两种:会做的,不会做的 对教主来说题目有两种:能AC的,数据有错的 菜鸟提交WA了, ...
- tp框架支付宝手机网页支付
开发环境:linux+php+mysql 密钥生成: 1.genrsa -out rsa_private_key.pem 1024 生成商户私钥,因在php环境,一定要保持原始状态,不得修改.rsa_ ...
- TI CC254x BLE教程 4
TI的CC254x芯片 1. SoC 2. RF收发器+8051MCU 128/256KB Code空间. 3. Master或者Slave 4. 可编程flash 5. 8KB SRAM 6. 全软 ...
- 调用css时,用link 和 @import url 有什么区别
加载css link与@import的区别: 其实 link 与 @import 在显示效果上还是有很大区别的,基本上来看 link 的加在会在页面显示之前全部加在完全,而 @import 会是读取完 ...