Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
74160 谢绍澜 19老李吃水果 C++ Wrong Answer 2 MS 656 KB 839 2024-05-23 19:40:15

Tests(0/5):


Code:

# include<iostream> using namespace std; int main(){ int n,c=0,max=0,k; cin>>k; for(int i=0;i<k;i++){ int a[100001]={0}; max=0; cin>>n; for(int g=0;g<n;g++){ cin>>c; a[c]++; } for(int i=0;i<100001;i++){ while(a[i]!=0){ if(a[i]>max){ max=a[i]; } break; } } if(n%2==0){ if(n/2>=max) cout<<"Y"<<endl; else cout<<"N"<<endl; } else{ if(n/2+1>=max) cout<<"Y"; else cout<<"N"; } } return 0; }


Run Info:

------Input------
5 6 1 2 4 2 2 4 5 1 1 1 2 1 5 1 1 1 2 1 5 1 1 1 2 1 5 1 1 1 2 1
------Answer-----
Y N N N N
------Your output-----
Y NNNN