HDU 1029 Ignatius and the Princess IV
来源:互联网 发布:java final 变量 编辑:程序博客网 时间:2024/06/08 02:54
题目地址:点击打开链接
思路:水题,求一个由n个数组成的数组种至少出现(n+1)/2次的数
AC代码:
#include<stdio.h>#include<string.h>int a[500000];int main(){ int n,i,j,b,k; while(scanf("%d",&n) != EOF) { memset(a,0,sizeof(a)); for(i=0; i<n; i++) { scanf("%d",&b); a[b]++; if(a[b] == (n+1) / 2) { k = b; break; } } for(j=i+1; j<n; j++) scanf("%d",&b); printf("%d\n",k); } return 0;}
0 0
- 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
- 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
- hdu - 1029 -Ignatius and the Princess IV
- 【数据结构】栈的基本操作
- java使用ScheduledExecutorService定时任务
- Ubuntu中PHP如何开启错误提示输出?
- MyISAM InnoDB 区别
- 链表逆序和链表翻转
- HDU 1029 Ignatius and the Princess IV
- textarea: 保留textarea中的换行,将源样式显示在页面
- 利用NuSoap开发WebService(PHP) 分类: php 2010-09-08 12:00 5832人阅读 评论(1) 收藏 举报 webservicephpsoapstringencod
- APK文件处理
- 33.Oracle数据库SQL开发之 使用简单函数——使用单行函数字符函数
- 【数据结构】最短路径
- 开发随笔 - 常用属性、方法
- 34.Oracle数据库SQL开发之 使用简单函数——使用单行函数数字函数
- Linux学习之命令(文件相关)