Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122452 冯诚阳 19老李吃水果 C++ Wrong Answer 1 MS 308 KB 804 2025-06-20 19:23:33

Tests(2/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]={0},x; cin>>k; for(int j=1;j<=k;j++){ a[10001]={0}; cin>>n; for(int i=1;i<=n;i++){ cin>>x; a[x]++; } int max=0; for(int i=1;i<=n;i++){ if(a[i]>max) max=a[i]; } 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; }


Run Info:

------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