#include<iostream>
#include<vector>
using namespace std;
int cnt[];
int main()
{
int time,n,limit;
vector<int> been;
while(cin>>time)
{
int a = ;
memset(cnt,,sizeof(cnt));
limit = (time+)/;
while(time--)
{
cin>>n;
cnt[n]++;
if(cnt[n]>=limit&&a)
{
cout<<n<<endl;
a=;
}
}
}
}

普通cnt数组

DP版本:

include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
_int64 n,a;
while(scanf("%I64d",&n)!=EOF)
{
_int64 b=,c;
while(n--)
{
scanf("%I64d",&a);
if(b==)
{
c=a;
b++;
}
else
{
if(c==a)
b++;
else
b--;
}
}
printf("%I64d\n",c);
}
return ;

B - Ignatius and the Princess IV DP的更多相关文章

  1. HDU 1029 Ignatius and the Princess IV DP

    kuangbin 专题 这题,有很多种解法. 第一种: 直接比较每个数出现次数. #include<iostream> #include<string> #include< ...

  2. HDU 1029 Ignatius and the Princess IV --- 水题

    HDU 1029 题目大意:给定数字n(n <= 999999 且n为奇数 )以及n个数,找出至少出现(n+1)/2次的数 解题思路:n个数遍历过去,可以用一个map(也可以用数组)记录每个数出 ...

  3. kuangbin专题十二 HDU1029 Ignatius and the Princess IV (水题)

    Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K ( ...

  4. hdu 1029 Ignatius ans the Princess IV

    Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K ( ...

  5. Ignatius and the Princess IV

    Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32767 K ( ...

  6. Ignatius and the Princess IV(乱搞一发竟然过了)

    B - Ignatius and the Princess IV Time Limit:1000MS     Memory Limit:32767KB     64bit IO Format:%I64 ...

  7. HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)

    HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...

  8. (Arrays.sort() 或 map) Ignatius and the Princess IV hdu1029

    Ignatius and the Princess IV 链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029 借鉴链接:https://blog.csd ...

  9. HDU 1029 Ignatius and the Princess IV (map的使用)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1029 Ignatius and the Princess IV Time Limit: 2000/10 ...

随机推荐

  1. CSS3中的弹性布局——"em"的用法

    使用CSS也好久了,但一直都是在使用“px”来设置Web元素的相关属性,未敢使用“em”.主要原因是,对其并不什么了解,只知道一点概念性的东西,前段时间在项目中要求使用“em”作为单位设置元素,所以从 ...

  2. 网站 robots.txt 文件编写

    网站 robots.txt 文件编写 Intro robots.txt 是网站根目录下的一个纯文本文件,在这个文件中网站管理者可以声明该网站中不想被robots访问的部分,或者指定搜索引擎只收录指定的 ...

  3. Atitit. 查找linux 项目源码位置

    Atitit. 查找linux 项目源码位置 1. netstat   -anp |grep 801 1.1. 1.3 启动关闭nginx3 1.2. 找到nginx配置文件4 1.3. ./etc/ ...

  4. 为阿里云站点部署免费 HTTPS

    本文记录了部署在阿里云的站点,在申请了免费的 SSL 证书后如何正确的部署到站点上,让站点支持 HTTPS 访问. 阿里云引入了沃通作为 CA 证书供应商,并开放了免费 SSL 申请的页面,之前一直想 ...

  5. Android http Request / Response ContentType

    客户端在进行http请求服务器的时候,需要告诉服务器请求的类型,服务器在返回给客户端的数据的时候,也需要告诉客户端返回数据的类型. 这个类型就是  ContentType  ,不同的ContentTy ...

  6. iOS 实用博客整理(连载版)

    iOS 实用博客整理(连载版) 本博客为本人觉得不错的博客的暂存地,并不是本人所写. 1.iOS开发 如何适配iOS10? 2.UIWebView和WKWebView的比较和选择 3. 如何快速的开发 ...

  7. svn的使用(转载)

    这里只介绍使用CornerStone来使用SVN. CornerStone是Mac OS X系统下非常好用的一款svn工具,当然还有Versions也是可以用的,但是使用起来不如CornerStone ...

  8. Socket.IO聊天室~简单实用

    小编心语:大家过完圣诞准备迎元旦吧~小编在这里预祝大家元旦快乐!!这一次要分享的东西小编也不是很懂啊,总之小编把它拿出来是觉地比较稀奇,而且程序也没有那么难,是一个比较简单的程序,大家可以多多试试~ ...

  9. Expdp 导数错误 ORA-00832

    问题实验环境 操作系统:Red Hat Enterprise Linux Server release 5.7 (Tikanga) 数据库  :Oracle Database 10g Release ...

  10. MySQL调优系列_日志分析

    前言 本篇主要总结一下MySQL数据库的几种日志,用于日常维护过程中问题解决和性能优化等,稍显基础,日常积累之用. 文章的部分内容会将MySQL数据库和SQL Server数据库部分内容做一个对比,非 ...