#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. Sass-也许你想和CSS玩耍起来(下篇)

    问心无愧,共勉! sass-也许你想和CSS玩耍起来(上篇) 上篇中主要介绍了一些sass的基本特性.下篇中,主要是写一些我们常用的sass控制命令,函数和规则. sass进阶 控制命令 可能看过上篇 ...

  2. Dev Winform 简洁界面模板制作

    今天看到Dev的安装程序,发现界面很漂亮如下图: 于是想到做个类似的简洁明了的界面出来,平常开发小程序什么的都方便很多. 1.首先是自己添加了一个XtraForm,我们发现它有点丑(我为了性能,习惯把 ...

  3. 元首的愤怒 SharePoint Apps

    柏林数据中心的服务器机架已经插满.CPU 100%.电力基础设施处在崩溃的边缘,但当元首决定迁移到 Office 365 的时候,将军们却告诉他那里没有 Farm Solution,5 年多的投资将付 ...

  4. Android中的AlertDialog使用示例三(单向选择确定对话框)

    在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,AlertDialog实现方法为建造者模式. ...

  5. Storm基础

    Storm基本概念 Storm是一个开源的实时计算系统,它提供了一系列的基本元素用于进行计算:Topology.Stream.Spout.Bolt等等. 在Storm中,一个实时应用的计算任务被打包作 ...

  6. XML语言基础3--Schema

    1.什么是Schema XML Schema是用一套预先规定的XML元素和属性创建的,这些元素和属性定义了XML文档的结构和内容模式. XML Schema规定XML文档实例的结构和每个元素/属性的数 ...

  7. params可变参数

    class Program { // params可变参数 //将实参列表中跟可变参数数组类型一致的元素都当做数组的元素去处理. //params可变参数必须是形参列表中的最后一个元素. static ...

  8. 把你的Project发布到GitHub上

    在上一篇文章中说明了如何使用远程仓库,接下来,就使用常用远程仓库GitHub来管理你的project. 1)在GitHub上创建仓库 要使用GitHub,肯定要注册GitHub帐户,然后建立一个仓库. ...

  9. CGLib动态代理原理及实现

    JDK实现动态代理需要实现类通过接口定义业务方法,对于没有接口的类,如何实现动态代理呢,这就需要CGLib了.CGLib采用了非常底层的字节码技术,其原理是通过字节码技术为一个类创建子类,并在子类中采 ...

  10. Linux 命令学习

    当前登陆目录: