#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<map>
#include<queue>
#include <deque>
#include <list>
#include <ctime>
#include <stack>
#include <vector>
#include<set>
#define Maxn 100050
#define MOD
typedef long long ll;
#define FOR(i,j,n) for(int i=j;i<=n;i++)
#define DFR(i,j,k) for(int i=j;i>=k;--i)
#define lowbit(a) a&-a
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
using namespace std;
struct mushroom
{
int s;
int f;
};
int flag[10010];
bool cmp(mushroom a,mushroom b)
{
if(a.f==b.f)return a.s<b.s;
return a.f>b.f;
}
int visit[10010];
mushroom s[10010];
int main()
{ int T;
scanf("%d",&T);
FOR(i,1,T)
{ FOR(j,0,10006)
s[j].f=0;
int N,x;
memset(visit,0,sizeof(visit));
int count = 0;
scanf("%d",&N);
FOR(j,1,N)
{
scanf("%d",&x);
s[200*x-x*x].s=200*x-x*x;
s[200*x-x*x].f++;
if(visit[200*x-x*x]==0)
{
count++;
visit[200*x-x*x] = 1;
}
}
sort(s,s+10000+1,cmp);
printf("Case #%d:\n",i);
if(count==1)
printf("%d\n",s[0].s);
else{
if(s[0].f==s[count-1].f)
printf("Bad Mushroom\n");
else
{
printf("%d",s[0].s);
FOR(j,1,10000)
{
if(s[j].f==s[0].f)
{
printf(" %d",s[j].s);}
else
break;
}
printf("\n");
}
}
}
return 0;
}
2014 ACM/ICPC Asia Regional Beijing Online Grade hdu5038
最新推荐文章于 2015-10-11 15:46:57 发布