ZOJ 3869 -- Ace of Aces

分享知乎大v文章—数据分析王中王:Yonghong Desktop对战Tableau Desktop 作为数据分析的爱好者,之前我是Tableau Desktop的深度用户,由于Tableau Desktop收费,免费的Public版本又在数据连接上有限制,所以常常限制了我的使用。从去年开始,我就切换到了国产的数据分析产品Yonghong Desktop。原因有二:一是Yonghong Desktop免费,二是Yonghong Desktop的表现丝毫不逊色于Tableau。 在切换到Yonghong Desktop之前,我从数据分析全链路对二者进行了较为全面的比对,结果让我略感惊讶。闲话少说,先列举一下 阅读详情


Ace of Aces
Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

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

题意:求出出现次数最多的且是唯一的数,若有多个则输出 Nobody。

代码如下:

#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
#include <functional>
#include <algorithm>
using namespace std;
#define N 1020
#define inf 0x3f3f3f3f
struct pp
{
	int num, v;
}p[N];
int Num[N];
int main()
{
#ifdef OFFLINE
	freopen("t.txt", "r", stdin);
#endif
	int t, i, j, k, n, m;
	scanf("%d", &t);
	while (t--){
		memset(p, 0, sizeof(p));
		memset(Num, 0, sizeof(Num));
		scanf("%d", &n);
		m = 0;
		for (i = 0; i < n; i++){
			scanf("%d", &k);
			Num[k]++;
		}
		if (n == 1){
			printf("%d\n", k); continue;
		}
		j = 0;
		for (i = 1; i <= 1000; i++){
			if (Num[i]){
				p[j].v = i;
				p[j++].num = Num[i];
			}
		}
		int max_1 = 0, max_v1 = 0, max_2 = 0, max_v2 = 0;
		for (i = 0; i<j; i++){
			if (p[i].num > max_1){//最大
				max_2 = max_1;
				max_v2 = max_v1;
				max_1 = p[i].num;
				max_v1 = p[i].v;
			}
			else if (p[i].num > max_2){//次大
				max_2 = p[i].num;
				max_v2 = p[i].v;
			}
		}
		if (max_1 == max_2)
			puts("Nobody");
		else
			printf("%d\n", max_v1);
	}
	return 0;
}


极限竞速:地平线5顶级版v1.653.463|容量174GB|赠单板联机补丁|解压即玩|包含DLC v1.653.463顶级版|容量174GB|官方简体中文|支持键盘.鼠标.手柄|赠810全车辆.全改装.剧情三星存档|赠单板联机补丁。 阅读详情

相关推荐

【Educoder作业】※ 数字图像——绿幕抠像

这次作业比上一篇博客基本得多,大多都是基础函数的运用。没啥说的,就整个sizesizesize即可。 T2 获取一个像素 T3 图像反色 T4 修改透明度 ′RGBA′'RGBA'′RGBA′也是一种图像格式 T5 抠图 T6 添加场景 这个主要是pastepastepaste函数里面的maskmaskmask参量没整明白,转载一篇博客供参考。...

JZYshuraK的博客 7571

k8s原理及操作

Kubernetes是一个开源的容器编排系统,其核心功能是实现资源管理的自动化。它通过Master节点控制集群,Node节点运行容器,Pod作为最小控制单元。主要组件包括:控制平面的kube-apiserver、etcd、kube-scheduler等;节点组件的kubelet、kube-proxy;以及附加组件如CoreDNS和Ingress Controller。Kubernetes支持自我修复、弹性伸缩、服务发现等功能,工作流程涉及API调用、调度和容器部署。部署时需配置环境、禁用防火墙和swap分区

m0_73575787的博客 2857

Cursor插件安装CodeX保姆级教程:从登录到调整面板布局,一步不落

本文提供Cursor编辑器安装CodeX插件的详细教程,涵盖从登录到调整面板布局的全流程。通过优化界面布局和配置参数,帮助开发者提升编码效率,特别适合需要智能代码补全的编程场景。

weixin_42648844的博客 4753

2025年1月人工智能投融资观察 · 极新月报

亿级以上融资21起,AI 医疗、具身智能成热门,早期融资继续主导

weixin_40303385的博客 1万+

聚类模型-层次聚类

聚类模型 1、层次聚类 2、原型聚类-K-means 3、模型聚类-GMM 4、EM算法-LDA主题模型 5、密度聚类-DBSCAN 6、图聚类-谱聚类 一、层次聚类 一、聚类理论 ​ 一般来说,聚类是在训练样本的标签信息不知的情况下,学习样本内在的性质和规律,将有限的集合划分成ccc类。根据“方以类聚,物以群分”的思想,类内对象尽可能的相似,...

myazi 6504

滚动时域优化方法

滚动时域优化(Receding Horizon Optimization, RHO),也被广泛称为模型预测控制(Model Predictive Control, MPC),是一种用于动态系统优化和控制的。其核心思想是“在每个当前时刻k,控制器只考虑未来一个(称为“预测时域”或“优化时域”,长度N)内的系统行为。(通过测量或估计得到)。(描述状态如何随输入和干扰变化)。(如果有,可能基于历史数据或假设)。在这个有限的未来时域[k, k+N-1]上,求解一个。这个优化问题的目标是找到一个。

m0_69522810的博客 2293

TowardsDataScience 博客中文翻译 2019(八十四)

答 irbnb 已经成为许多旅行者的首选,不仅是在世界各地寻找住宿的时候,也是在到达一个城市之前探索这个城市的时候。当考虑在目的地过夜时,人们会想要一个“家外之家”。因此,Airbnb 为市场重塑了一个独特的、鼓舞人心的蓝海,“蓝海战略是同时追求差异化和低成本以开辟新的市场空间和创造新的需求。”在蓝海,需求是创造出来的,而不是争夺出来的。Airbnb 为顾客和主人提供了双赢的局面;虽然顾客可以以较低的价格获得住宿,但主人可以通过出租他们的房产来赚钱。

龙哥盟 3521

[Python图像处理] 一.图像处理基础知识及OpenCV入门函数

该系列文章是讲解Python OpenCV图像处理知识,前期主要讲解图像入门、OpenCV基础用法,中期讲解图像处理的各种算法,包括图像锐化算子、图像增强技术、图像分割等,后期结合深度学习研究图像识别、图像分类应用。希望文章对您有所帮助,如果有不足之处,还请海涵~ 同时推荐作者的C++图像系列知识: [数字图像处理] 一.MFC详解显示BMP格式图片 [数字图像处理] 二.MFC单文档分割窗...

杨秀璋的专栏 7万+

ZOJ 3869 Ace of Aces

思路:找出现次数最多的那个数,如果有多个输出nobody #include using namespace std; int a[1001]; int T; int main() { scanf("%d",&T); while(T--) { memset(a,0,sizeof(a)); int n; scanf("%d",&n);

围巾的ACM博客 697

【Claude】Claude Code 子代理(Subagents)完全指南:多 AI 编排与并行任务管理

子代理是在独立上下文窗口特性主代理子代理上下文窗口与你对话的主上下文完全独立的上下文工具权限拥有所有工具可自定义限制生命周期整个会话完成任务后结束通信方式直接对话结果返回给主代理模型继承主会话设置可指定不同模型你可以创建专属子代理,指定模型、工具权限和系统提示。在对话中,Claude 会根据任务自动选择合适的子代理。

博客 5538

YOLOv11来了,使用YOLOv11训练自己的数据集和推理(附YOLOv11网络结构图)

YOLOv11 由 Ultralytics 在 2024 年 9 月 30 日发布, 最新的 YOLOv11 模型在之前的 YOLO 版本引入了新功能和改进,以进一步提高性能和灵活性。YOLO11 在快速、准确且易于使用,使其成为各种对象检测和跟踪、实例分割、图像分类和姿态估计任务的绝佳选择。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 28万+

ZOJ 3869 Ace of Aces

题意:给出一个个数为n的序列,求出其中的众数,若有多个众数,则输出Nobody 链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5517 思路:排序后统计众数 注意点:无 以下为AC代码: Run ID Submit Time Judge Status Problem ID Lan

luminous11的专栏 497

Vue3 - Element Plus上传组件el-upload上传多个文件时,让on-change监听事件仅执行一次并获取最终文件列表方法(开启多选文件并手动上传,拿到文件列表统一循环调用接口上传)

vue3,elementplus,Upload上传,el-upload,文件上传组件,上传组件on-change里执行多次,取消自动上传后change重复执行问题,upload上传多个文件后导致on-change执行多次拿不到最终文件列表,Element-plus的upload组件on-change不断执行怎么办,上传多个文件多次执行调用,上传多个文件时如何只执行一次on-change方法拿到最终的文件列表,vue3elementplus上传组件开启多个上传后导致change方法执行好几次,仅调用一

🏆 前端领域优质创作者 1万+

zoj 3869 Ace of Aces

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 di

世界很大 631

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

ZOJ - 3869 Ace of Aces

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

梦想天空分外蓝 296

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

A - Ace of Aces ZOJ - 3869 -mystical_curve

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

mystical_curve的博客 291

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Ace of Aces ZOJ - 3869

寻找出现次数最多,如果有多个 输出Nobody//leehaoze #include <iostream> #include <deque> #include <string> #include <vector> #include <queue> #include <cstdio> #include <stack> #include <algorithm> #include <cstring> #i

lee_haoze的博客 317

ZOJ 3869:Ace of Aces【水】

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 disco

所谓梦想,就是永不停息的疯狂。。。。。 447

ZOJ - 3869 Ace of Aces (水)

ZOJ - 3869 Ace of Aces Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu SubmitStatus Description There is a mysterious organization called Time-Sp

yanghui07216的博客 445

ZOJ 3869 Ace of Aces(序列处理)

题意:n张投票,投票最多的人成为王中王,但是不能有两个王中王。 题记:把投票编号记录下来,遍历一遍找票数最多的,最后再看一下拥有最多票数的是不是只有他一人即可。 #include<bits/stdc++.h> using namespace std; const int N=1010; int t[N]; int main(){ int T; cin>>T; while(T--){ memset(t,0,sizeof(t));

moyangxian 219

ZOJ3869 Ace of Aces

题目链接:http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5493 题意&思路: 大水题不言不语。 源码: #include  #include  #include  #include  #include  #include  #include  #define gmax(a,b) a>b?a

beihai2013 450

ZOJ - 3869 Ace of Aces(简单题)

题目链接: [Ace of Aces] 大致题意: T组,每组n个数,找到出现次数最多的一个数,若没有输出Nobody 解题思路: 看代码 AC代码: #include <bits/stdc++.h> typedef long long ll; using namespace std; int a[2000]; int b[2000]; int main(void) { int t; scanf("%d", &t); while (t--) { memset(a, 0, s

qq_49494204的博客 217

ZOJ3869:Ace of Aces(浙江省赛2015)

The 12th Zhejiang Provincial Collegiate Programming Contest  There is a mysterious organization called Time-Space Administrative Bureau (TSAB) in the deep universe that we humans have not discove

ACM!荣耀之路! 2238

ZOJ3869 Ace of Aces【序列处理+水题】

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 dis

海岛Blog 1526
上一篇: ZOJ 3878 Convert QWERTY to Dvorak
下一篇: hdu--5670--Machine (模拟三进制)
yibin94
博客等级 码龄11年 78粉丝 158原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值