当前位置:网站首页>英雄出场王 C语言
英雄出场王 C语言
2022-04-21 18:16:00 【大菜彩】
英雄出场王
英雄联盟总决赛正在若火如荼的展开,盲僧、刀妹、酒桶、青钢影等各路英雄悉数登场,当一个英雄被选出场时系统自动登记其序号,出场次数最多的英雄成为出场王。给定英雄序号的出场集合T,例如,T={2,4,4,4,6,7}。其出场王是4号英雄,出场次数为3。对于给定的由n个序号组成的出场集T,计算出场王序号及其出场次数。如果出现多个出场王,请输出序号最小的那个。
输入格式:
输入数据的第1行是英雄出场集T中序号个数n(n<1000);第二行输入n个出场英雄序号(不超过5位数字的自然数)。
输出格式:
输出数据的第1行给出出场王序号,第2行是出场次数。
输入样例:
在这里给出一组输入。例如:
6
2 4 4 4 6 7
输出样例:
在这里给出相应的输出。例如:
4
3
代码:
#include<stdio.h>
int main()
{
int n,i,j=0,m,t=0,a[1001]={
0};
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
a[m]++;
}
for(i=0;i<1000;i++)
if(a[i]!=0)
if(a[i]>t)
{
t=a[i];
j=i;
}
printf("%d\n",j);
printf("%d",a[j]);
return 0;
}
版权声明
本文为[大菜彩]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_53786696/article/details/124326268
边栏推荐
- [intensive reading of Thesis] perception based seam cutting for image stitching
- Live app source code, add picture display function on the basis of unable to display pictures
- 随笔小杂记(六)——tqdm进度条显示出现多余行
- k-means,层次,EM聚类介绍
- MySQL - remote connection to non local MySQL database server, Error 1130: host 192.168.3.100 is not allowed to connect to this MySQL s
- ansible简单使用示例
- Educational Codeforces Round 116 (Rated for Div. 2) E. Arena
- Target penetration exercise 76-dc8
- Summary of mongodb user permissions
- After fastjson is automatically upgraded to fastjson2, the idea development environment is normally printed into a jar package and an error exception POM is reported after publishing the generated env
猜你喜欢

About LINQ statements

观测云登陆阿里云计算巢,共建ISV新生态

你必须懂也可以懂的微服务系列三:服务调用

Kubernetes详解(四)——基于kubeadm的Kubernetes部署

Look at how the technology house saves Xueba machine. I repaired my laptop with 10 yuan

年末我的Android面试复盘

In order to offer several big factories, "closed door practice"

Target penetration exercise 70-dc2

Target penetration exercise 69-dc1

华为18级大牛整理总结:微服务设计和分布式服务框架原理实践文档
随机推荐
信息系统项目管理师专有名词英文缩写&常见词汇
年末我的Android面试复盘
Mongodb用户权限总结
Is Guotai Junan safe? It's reliable
What is the default user name and password of MySQL?
WPF RichTextBox赋值与取值
Live broadcast with goods source code, different writing methods of gradient status bar
一个通用的CommonDialog
C语言进阶第48式:函数设计原则
Porting openharmony and adding WiFi driver
Huawei level 18 Daniel collates and summarizes: microservice design and distributed service framework principle practice document
After fastjson is automatically upgraded to fastjson2, the idea development environment is normally printed into a jar package and an error exception POM is reported after publishing the generated env
别找了,这是迄今为止把微服务讲的最清楚的一篇!没有之一
关于Linq语句
Easy to use example
Target penetration exercise 69-dc1
[牛客网刷题 Day4] JZ76 删除链表中重复的结点(递归)
【网络】4G、5G频段汇总
人员不足、供应链断裂,危机之下制造业该如何自救?
华为、TCL、大疆