HDU-1029-Ignatius and the Princess IV
来源:互联网 发布:数据库安全防护总结 编辑:程序博客网 时间:2024/06/03 14:59
题意
给出一个N(奇数)个数的序列求 序列中某个出现频率超过(N+1)/2的数
解法
水题
#include <iostream> #include <cstdio> #include <cstdlib> using namespace std; int main() { int n; while(cin>>n) { int temp,t=0,ans; while(n--) { scanf("%d",&temp); if(t==0) { ans=temp; t++; } else { if(ans==temp) { t++; } else { t--; } } } cout<<ans<<endl; } 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
- coderforce 572B Order Book
- QT学习之QString的arg方法
- Android Radio Interface Layer
- nginx 正则表达式匹配入门篇 .
- 实例分析JVM安全体系:双亲委派、命名空间、保护域、策略
- HDU-1029-Ignatius and the Princess IV
- 添加core 服务和app 服务 root 权限执行
- POJ1987(树分治)
- update-alternatives
- PHP知识点小记
- 64位Win7 IIS报 CS0016错误 解决办法
- House Robber II
- VTK+cmake+vs2008安装和编译,学习笔记
- spring mvc 接收返回json串