Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7130 | 吴承熹 | 19老李吃水果 | C++ | Wrong Answer | 0 MS | 304 KB | 948 | 2025-04-05 10:42:37 |
#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(0)); } return 0; }
------Input------
3 6 1 2 4 2 2 4 5 1 1 1 2 1 6 1 2 4 2 2 4
------Answer-----
Y N Y
------Your output-----
Y N N