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. easyUI-combobox 后台导入Json数据的方法

    一.前台页面: <input id="List" class="easyui-combobox" data-options="valueFiel ...

  2. re正则表达式5_*

    *表示匹配[0,正无穷大]次 * means math zero or more-----occur any number of times in the text. # -*- coding: ut ...

  3. js 限制input输入字节长度

    function WidthCheck(str, maxLen){ var w = 0; var tempCount = 0; //length 获取字数数,不区分汉子和英文 for (var i=0 ...

  4. 使用ASP.NET Web Api构建基于REST风格的服务实战系列教程【三】——Web Api入门

    系列导航地址http://www.cnblogs.com/fzrain/p/3490137.html 前言 经过前2节的介绍,我们已经把数据访问层搭建好了,从本章开始就是Web Api部分了.在正式开 ...

  5. c++vector(入门级)

    #include<iostream> #include<fstream>> #include<vector> using namespace std; voi ...

  6. javascript 小技巧

    1:Boolean()==!! console.log(Boolean(888));//true console.log(!!(888));//true console.log(Boolean(&qu ...

  7. ecshop去头部和掉底部版权

    1.去掉头部版权 打开includes/lib_main.php $page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ...

  8. Session共享的解决方案

    http://www.cnblogs.com/xinhaijulan/archive/2010/08/21/1805116.html Session共享的解决方案 1.客户端SessionID值唯一: ...

  9. CentOS下nginx简单安装

    说明:环境 系统:Centos 6 软件包:nginx-1.2.4 配置系统yum源 #/etc/yum.repos.d/ #rm -rf ./* vi localhost.repos.d [yumy ...

  10. 怎么搭建Web Api

    1.通常我们有个web 让后可以有个web api 提供接口2.通常我们分别建两个项目 web api 依赖web的来进行访问(说到底是依赖是IIS)3.我们先建个SmallCode.Test.Web ...