# A-ace of Aces--zoj

Source: Internet
Author: User

A-Ace of AcesTime limit:\$ MS Memory Limit:65536KB 64bit IO Format:%lld & Amp %llu SubmitStatus

Description

There is a mysterious organization called Time-space administrative Bureau (TSAB) in the deep universe that we Hu Mans has not discovered yet. This year, the TSAB decided to elect a outstanding member from its elite troops. The elected guy would be honored with the title of "Ace of Aces".

After voting, the TSAB received N valid tickets. On each ticket, there is a number Ai denoting the ID of a candidate. The candidate with the most tickets nominated would be elected as the "Ace of Aces". If there is, or more candidates has the same number of nominations, no one would win.

Tsab determine who'll be the "Ace of Aces".

Input

There is multiple test cases. The first line of input contains an integer indicating the number of the T test cases. For each test case:

The first line contains an integer N (1 <= N <= 1000). The next line contains N integers Ai (1 <= Ai <= 1000).

Output

For each test case, the output the ID of the candidate who would be honored with "Ace of Aces". If no one win the election, output "Nobody" (without quotes) instead.

Sample Input

`352 2 2 1 151 1 2 2 31998`

Sample Output

`2nobody998`

Using array storage, find the first second-largest number and compare it!

`#include <stdio.h> #include <string.h> #define MAX 2000typedef struct node{int v;int c;} Node;int Main () {int n,m,v[max],t,i,j,max,maxx,k,flag; NODE que[1005];scanf ("%d", &n), for (k=1;k<=n;k++) {flag=0;memset (v,0,sizeof (v)); scanf ("%d", &m); for (I=1; i<=m;i++) {scanf ("%d", &t); v[t]++;} int Len=0;for (i=1;i<max;i++) {if (V[i]) {que[len].c=i;que[len].v=v[i];len++;}} Max=0;for (i=0;i<len;i++) {if (MAX<QUE[I].V) {max=que[i].v;maxx=que[i].c;t=i;}} int Temp=max;int tempx=maxx;que[t].v=-1;max=0;for (i=0;i<len;i++) {if (MAX<QUE[I].V) {Max=que[i].v;maxx=que[i] . C;}} if (max==temp) printf ("nobody\n"); elseprintf ("%d\n", tempx);} return 0;}`

A-ace of Aces--zoj

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.