Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7134 吴承熹 19老李吃水果 C++ Accepted 0 MS 304 KB 948 2025-04-05 10:43:47

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[10001]={},p,m=0; cin>>k; for(int i=1;i<=k;i++){ cin>>n; for(int t=1;t<=n;t++){ cin>>p; a[p]++; } for(int t=1;t<=n;t++){ if(a[t]>m){ m=a[t]; } } if(n%2==0){ if(m<=n/2){ cout<<'Y'<<endl; } else{ cout<<'N'<<endl; } } else{ if(m<=n/2+1){ cout<<'Y'<<endl; } else{ cout<<'N'<<endl; } } m=0; memset(a,0,sizeof(a)); } return 0; }