标签:des style blog http color io os java ar
3 6 100 100 100 99 98 101 6 100 100 100 99 99 101 6 100 100 98 99 99 97
Case #1: 10000 Case #2: Bad Mushroom Case #3: 9999 10000
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<map> #include<vector> #include<cmath> #include<string> #include<queue> #define eps 1e-9 #define ll long long #define INF 0x3f3f3f3f using namespace std; const int maxn=10000+10; int a[maxn],n,b[maxn]; int main() { int t,val,temp,cnt,max_,cas=1,num,star,first,second; scanf("%d",&t); while(t--) { int ok=0; scanf("%d",&n); num=0; max_=-1; cnt=1; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(int i=1;i<=n;i++) { scanf("%d",&temp); val=10000-(100-temp)*(100-temp); a[val]++; if(i==1) first=val; else { if(first!=val) ok=1; } } printf("Case #%d:\n",cas++); if(ok==0) { printf("%d\n",first); continue; } for(int i=0;;i++) if(a[i]>0) { second=i; star=a[i]; break; } for(int i=second;i<=10001;i++) { if(a[i]>0) { if(a[i]>max_) max_=a[i]; if(a[i]!=star) cnt++; } } if(cnt==1) printf("Bad Mushroom\n"); else { for(int i=0;i<=10001;i++) { if(a[i]==max_) b[++num]=i; } for(int i=1;i<num;i++) printf("%d ",b[i]); printf("%d\n",b[num]); } } return 0; }
标签:des style blog http color io os java ar
原文地址:http://blog.csdn.net/u014303647/article/details/39479033