HUD 1029Ignatius and the Princess IV
来源:互联网 发布:资源数据库建设 编辑:程序博客网 时间:2024/05/02 03:02
原题链接:[kuangbin带你飞]专题十二 基础DP1
B - Ignatius and the Princess IV
题意:
第一行输入n,表示有n个元素 n小于一百万
第二行输入n个元素
输出n个元素中出现次数大于二分之n的元素
思路
打表
#include"stdafx.h"#include <iostream>#include<cstdio>#include <algorithm>#include <cstring>using namespace std;int n, t, ans;int a[1000000];int main(){ while (~scanf("%d", &n)) { memset(a, 0, sizeof(a)); ans = t = 0; for (int i = 0; i < n; i++) { scanf("%d", &t); a[t]++; if (a[t] == (n + 1) / 2) { ans = t; } } printf("%d\n", ans); }}
0 0
- HUD 1029Ignatius and the Princess IV
- HUD 1029 Ignatius and the Princess IV
- 【HUD 1029】Ignatius and the Princess IV(思维-水题)
- hdu 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- Ignatius and the Princess IV hdu 1029
- 【HDOJ】1029 -> Ignatius and the Princess IV
- hdoj 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- jQuery Form 表单提交插件-----formSerialize,fieldSerialize,fieldValue,resetForm,clearForm,clearFields的 应用
- 新浪微盘3
- 自定义seekbar
- react native -- this.props.children
- 关于baidu_tempalate 的使用
- HUD 1029Ignatius and the Princess IV
- 小心别让圆角成了你列表的帧数杀手
- java读取数据库配置文件
- ajax 接受 php echo 与 return 区别
- Pandas处理表格
- C++必读书籍推荐
- PHP安装扩展
- Exploring Threads 探索线程
- JS时间控件-laydate