http://115.28.138.223:81/view.page?opid=1

第一题用一组STL函数查找即可

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define within(x,a,b) ((unsigned)((x)-(a))<=((b)-(a)))
using namespace std;
int a[],n;
int d[];
int readint(int *p)
{
int ch;
while(!within(ch=getchar(),'',''))
if(ch == EOF) return EOF;
int rslt = ;
do
rslt=rslt*+(ch-'');
while(within(ch=getchar(),'',''));
*p = rslt;
return ;
}
int donser(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main()
{
while(cin>>n)
{
memset(a,,sizeof(a));
memset(d,,sizeof(d));
for(int i=;i<n;i++)
{
readint(&a[i]);
}
qsort(a,n,sizeof(int),donser);
int max=,num=,minum=;
for(int i=;i<n;i++)
{
if(d[a[i]]==) continue;
d[a[i]]=;
num=upper_bound(a,a+n,a[i])-lower_bound(a,a+n,a[i]);
if(num>max)
{
max=num;
minum=a[i];
}
else if((num==max)&&(minum>a[i]))
{
minum=a[i];
}
}
cout<<minum<<endl;
}
return ;
}

CCF 模拟A 无脑大循环的更多相关文章

  1. CCF 模拟B 无脑循环+输入输出外挂

    http://115.28.138.223:81/view.page?opid=2#code 代码一有WA点80分 #include<iostream> #include<cstdi ...

  2. 计蒜客 无脑博士 bfs

    题目链接无脑博士的试管们 思路:直接模拟倒水过程即可,但是需要记忆判断当前的情况是否已经处理过.dfs和bfs都ok AC代码 #include <cstdio> #include < ...

  3. CodeForces 909E Coprocessor(无脑拓扑排序)

    You are given a program you want to execute as a set of tasks organized in a dependency graph. The d ...

  4. 【原】无脑操作:express + MySQL 实现CRUD

    基于node.js的web开发框架express简单方便,很多项目中都在使用.这里结合MySQL数据库,实现最简单的CRUD操作. 开发环境: IDE:WebStorm DB:MySQL ------ ...

  5. Go语言及Web框架Beego环境无脑搭建

    [原]Go语言及Web框架Beego环境无脑搭建 本文涉及软件均以截至到2013年10月12日的最新版本为准 1. 相关软件准备: 1) go1.2rc1.windows-386.msi,对应32位w ...

  6. 【原】无脑操作:eclipse + maven搭建SSM框架

    网上看到一些Spring + Spring MVC + MyBatis框架的搭建教程,不是很详细或是时间久远了,自己动手整一个简单无脑的! 0.系统环境 1)Windows 10 企业版 2)JDK ...

  7. 【原】无脑操作:ElasticSearch学习笔记(01)

    开篇来自于经典的“保安的哲学三问”(你是谁,在哪儿,要干嘛) 问题一.ElasticSearch是什么?有什么用处? 答:截至2018年12月28日,从ElasticSearch官网(https:// ...

  8. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础授权权限

    上一篇<[原]无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限>介绍了实现Shiro的基础认证.本篇谈谈实现 ...

  9. 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限

    开发环境搭建参见<[原]无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页> 需求: ① 除了登录页面,在地址栏直接访问其他 ...

随机推荐

  1. logo上传

  2. Java排序算法——快速排序

    import java.util.Arrays; //================================================= // File Name : Arrays_Q ...

  3. Java包装类

    自动装箱:指开发人员可以把一个基本数据类型直接赋给对应的包装类 自动拆箱:指开发人员可以把一个包装类对象直接赋给对应的基本数据类型 要把基本数据类型称为对象的时候,需要把基本数据类型进行包装, 运用: ...

  4. this.name=name;和this.setName(name);的区别

    其实一般属性设置为private后,才会写属性的set和get方法 在本类中可以用 this.name=name 但是,在其他类中药给name赋值,就只能用set了

  5. shelve模块理解

    import shelve import sys def store_person(db): pid = input("Enter unique ID mnumber:") per ...

  6. Ankh不起作用的解决方法

    请检查Visual Studio 2008的Tool > Options... > Source Control,在下拉菜单中选择插件.

  7. 图片延迟加载jquery插件imgLazyLoading

    实现了图片延迟加载功能,插件代码非常简洁,且每个功能都把注释写得非常详细,适合网友们学习,好好利用哦 引入图片延迟加载Jquery插件文件后,页面使用代码如下: <script type=&qu ...

  8. PHP页面跳转

    PHP页面跳转一.header()函数 header()函数是PHP中进行页面跳转的一种十分简单的方法.header()函数的主要功能是将HTTP协议标头(header)输出到浏览器. header( ...

  9. Unity时钟定时器插件

    Unity时钟定时器插件 http://dsqiu.iteye.com/blog/2020603https://github.com/joserocha3/KillerCircles/blob/67a ...

  10. C#技术漫谈之垃圾回收机制(GC)(转)

    GC的前世与今生 虽然本文是以.NET作为目标来讲述GC,但是GC的概念并非才诞生不久.早在1958年,由鼎鼎大名的图林奖得主John McCarthy所实现的Lisp语言就已经提供了GC的功能,这是 ...