#include<stdio.h>
int main()
{
int n,a[],b[]={};
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
} for(int i=;i<n;i++)
{
for(int j=i+;j<n;j++)
{
if(a[i]==a[j])
{
b[i]++;
}
}
} int m=b[];
for(int i=;i<n;i++)
{
if(b[i]>m)
m=b[i];
} for(int i=;i<n;i++)
{
if(b[i]==m)
{
printf("%d\n",a[i]);
}
}
}
return ;
}

Problem A: 零起点学算法91——找出一个数组中出现次数最多的那个元素的更多相关文章

  1. Problem B: 零起点学算法81——找出数组中最大元素的位置(下标值

    #include<stdio.h> int main(void) { ],i,max; while(scanf("%d",&n)!=EOF) { ;i<n ...

  2. [PY3]——找出一个序列中出现次数最多的元素/collections.Counter 类的用法

    问题 怎样找出一个序列中出现次数最多的元素呢? 解决方案 collections.Counter 类就是专门为这类问题而设计的, 它甚至有一个有用的 most_common() 方法直接给了你答案 c ...

  3. 笔试题&amp;面试题:找出一个数组中第m小的值并输出

    题目:找出一个数组中第m小的值并输出. 代码: #include <stdio.h> int findm_min(int a[], int n, int m) //n代表数组长度,m代表找 ...

  4. 找出整数数组中出现次数超过数组长度一半的元素(Java)

    Question:数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字 package com.study.zhipengs.test; import java.util.Arrays; im ...

  5. Problem H: 零起点学算法109——单数变复数

    #include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...

  6. Problem G: 零起点学算法106——首字母变大写

    #include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...

  7. Problem D: 零起点学算法95——弓型矩阵

    #include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...

  8. Problem F: 零起点学算法42——多组测试数据输出II

    #include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...

  9. Problem E: 零起点学算法34——3n+1问题

    #include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...

随机推荐

  1. 编写jquery Plugin

    编写jquery插件的原则 1.给$.fn绑定函数,实现插件的代码逻辑 2.插件函数最后要return this,以支持链式调用 3.插件函数要有默认值,绑定在$.fn.<pluginName& ...

  2. net_device->uc_promisc

    如果设备不支持单播过滤,并且要监听多个单播地址时,就要使用net_device->uc_count和net_device->uc_promisc来设置混杂模式,具体见__dev_set_r ...

  3. $scope作用及模块化解决全局问题

    $scope对象就是一个普通的JavaScript对象,我们可以在其上随意修改或添加属性.$scope对象在AngularJS中充当数据模型,但与传统的数据模型不一样,$scope并不负责处理和操作数 ...

  4. SVN使用详解

    一.SVN的使用 项目经理使用,写好项目框架.文档等. 李四(程序员)的使用,在项目经理写好的框架上进行开发. 二.SVN三大指令 Checkout(检出操作): 连接到svn服务器 更新服务器数据到 ...

  5. freemark学习

    学习地址: http://blog.csdn.net/hejinxu/article/details/6694890   对freemarker的用法与语法进行了详细的讲解 http://freema ...

  6. LeetCode解题报告—— Group Anagrams & Pow(x, n) & Spiral Matrix

    1. Group Anagrams Given an array of strings, group anagrams together. For example, given: ["eat ...

  7. python math模块

    import math math. ceil:取大于等于x的最小的整数值,如果x是一个整数,则返回x copysign:把y的正负号加到x前面,可以使用0 cos:求x的余弦,x必须是弧度 degre ...

  8. ELK日志处理

    ELK的工作原理: 使用多播进行机器发现同一个集群内的节点,并汇总各个节点的返回组成一个集群,主节点要读取各个节点的状态,在关键时候进行数据的恢复,主节点会坚持各个节点的状态,并决定每个分片的位置,通 ...

  9. 使用dpkg命令卸载已经安装的软件包

    如何在Ubuntu中使用dpkg命令卸载软件 http://jingyan.baidu.com/article/f54ae2fc2724a71e92b849c4.html sudo dpkg -i x ...

  10. 【JBPM4】任务节点-任务分配candidate-groups

    此分组的意思是,该任务节点为多个人员,当其中之一完成后,流程就进入下一个节点. JPDL <?xml version="1.0" encoding="UTF-8&q ...