【题目链接】click here~~
【题目大意】每张票有不同的投票数,如果有两张或以上的相同则无法选拔“Ace of Aces”,给出票的数目,判断是否符合
【解题思路】:签到题
代码:
#include<bits/stdc++.h>
using namespace std;
int a[1001];
int main()
{
// freopen("in.txt","r",stdin);
int T;
cin>>T;;
while(T--)
{
memset(a,0,sizeof(a));
int top;
int n;
cin>>n;;
for(int i=0; i<n; i++){
cin>>top;
a[top]++;//每张票的得数
}
bool flag=0;
int maxx=0;
int res=-1;
for(int i=0; i<1001; i++)
if(maxx<a[i])//得出最大投票的人
{
maxx=a[i];
res=i;
}
for(int i=0; i<1001; i++) if(maxx==a[i]&&res!=i)
{
puts("Nobody");
flag=1;
break;
}
if(flag) continue;
else printf("%d\n",res);
}
return 0;
}