Ace of Aces ZOJ - 3869
2017-04-16 20:33
211 查看
寻找出现次数最多,如果有多个 输出Nobody
//leehaoze #include <iostream> #include <deque> #include <string> #include <vector> #include <queue> #include <cstdio> #include <stack> #include <algorithm> #include <cstring> #include <cctype> #include <cstdio> #include <cmath> #include <cstdlib> using namespace std; const int INF = 1<<29; #define INC_SAT( val ) (val = ((val)+1 > (val)) ? (val)+1 : (val)) #define ARR_SIZE( a ) ( sizeof( (a) ) / sizeof( (a[0]) ) ) #define ULL unsigned long long #define MAXN (1000 + 5) struct People{ int id_; int num_; }; People people[MAXN]; int cmp(const People A,const People B){ return A.num_ > B.num_; } void Init(){ for (int i = 0; i < MAXN; ++i) { people[i].num_ = 0; } } int main() { #ifdef LOCAL freopen("IN.txt", "r", stdin); #endif int T; while(scanf("%d",&T) != EOF) { while(T--) { Init(); int N; scanf("%d", &N); for (int i = 0; i < N; ++i) { int temp; scanf("%d", &temp); people[temp].id_ = temp; people[temp].num_++; } sort(people, people + MAXN, cmp); if (people[0].num_ == people[1].num_) { printf("Nobody\n"); } else { printf("%d\n", people[0].id_); } } } }
相关文章推荐
- ZOJ 3869 Ace of Aces
- ZOJ-3869 Ace of Aces
- zoj-3869-Ace of Aces
- zoj 3869 Ace of Aces (水题)
- ZOJ 3869 Ace of Aces (The 12th Zhejiang Provincial Collegiate Programming Contest)
- ZOJ 3869 Ace of Aces
- zoj 3869 Ace of Aces
- ZOJ - 3869 Ace of Aces (水)
- ZOJ 3869 -- Ace of Aces
- ZOJ 3869 Ace of Aces
- ZOJ3869 Ace of Aces
- ZOJ 3869-Ace of Aces【模拟众数】
- ZOJ Problem Set - 3869||Ace of Aces
- ZOJ 3869:Ace of Aces【水】
- A - Ace of Aces ZOJ - 3869 -mystical_curve
- 水题 ZOJ 3869 Ace of Aces
- A - Ace of Aces——ZOJ
- ACM刷题之ZOJ————Ace of Aces
- zoj3869 Ace of Aces && zoj3880 Demacia of the Ancients(水)
- Ace of Aces