hdu1029 技巧
来源:互联网 发布:淘宝的消费总额怎么看 编辑:程序博客网 时间:2024/06/07 12:50
/**************************************
*Author :jibancanyang
*Created Time : 二 4/ 5 22:00:39 2016
*题目类型:很好的利用了过半的特性,记录当前最大频率数和他的频率.
***************************************/
#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <set>#include <map>#include <string>#include <cmath>#include <cstdlib>#include <ctime>#include <stack>using namespace std;typedef pair<int, int> pii;typedef long long ll;typedef unsigned long long ull;vector<int> vi;#define xx first#define yy second#define sa(n) scanf("%d", &(n))#define rep(i, a, n) for (int i = a; i < n; i++)#define vep(c) for(decltype((c).begin() ) it = (c).begin(); it != (c).end(); it++) const int mod = int(1e9) + 7, INF = 0x3fffffff, maxn = 1e5 + 12;int main(void){#ifdef LOCAL //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);#endif cin.sync_with_stdio(false); int n; while (cin >> n) { int key = -123433, cnt = 0; rep(i, 0, n) { int x; cin >> x; if (x != key) { if (cnt == 0) key = x, cnt++; else cnt--; } else cnt++; } cout << key << endl; } return 0;}Status API Training Shop Blog About
0 0
- hdu1029 技巧
- hdu1029
- HDU1029
- hdu1029
- hdu1029
- hdu1029
- hdu1029
- HDU1029
- HDU1029
- HDU1029
- HDU1029 水题
- hdu1029(基础)
- 【HDU1029】B
- HDU1029时钟(排序)
- HDU1029 False coin
- HDU1029(水)
- HDU1029 找中间数
- HDU1029:Ignatius and the Princess IV
- 3.7.5 event_loop:事件循环
- 64位win7系统中JDK的安装及环境变量的配置
- Android Studio常用插件
- Linux下undefined reference to ‘pthread_create’问题解决
- 浏览器、操作系统DNS缓存时间
- hdu1029 技巧
- ListView使用ViewHolder模式提高效率
- SQL实现Split功能
- 使用CHOOSE使用举例-动态排序字段
- 怎样批量修改MathType公式格式
- Android apk动态加载机制的研究
- Zookeeper实战之单机集群模式
- Hdu1533
- (OK) fedora23——add “opening terminal” in the menu of right click