Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7271 谢锦卓 19老李吃水果 C++ Accepted 7 MS 304 KB 599 2025-04-12 11:24:44

Tests(5/5):


Code:

#include<bits/stdc++.h> using namespace std; int a[10001],k,n,_max; int main(){ cin>>k; while(k--){ cin>>n; for(int i=1;i<=n;i++){ int temp; cin>>temp; a[temp]++; _max=max(_max,a[temp]); } if(n%2==0){ if(_max<=n/2) cout<<"Y"<<endl; else cout<<"N"<<endl; } else{ if(_max<=(n/2+1)) cout<<"Y"<<endl; else cout<<"N"<<endl; } _max=0; memset(a,0,sizeof(a)); } return 0; }