Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
108970 高楷伦 19老李吃水果 C++ Accepted 1 MS 316 KB 851 2025-01-23 17:48:44

Tests(5/5):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int k,n,a[10000]={0},x,max; cin>>k; for(int i=0;i<k;i++){ cin>>n; for(int j=0;j<10000;j++) a[j]=0; max=0; for(int j=1;j<=n;j++){ cin>>x; a[x]++; } for(int j=1;j<=n;j++){ if(a[j]>max&&a[j]>0) max=a[j]; } if(n%2==0){ if(max>n/2) cout<<"N"<<endl; else cout<<"Y"<<endl; } else{ if(max>n/2+1) cout<<"N"<<endl; else cout<<"Y"<<endl; } } return 0; }