Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
123598 顾文博 19老李吃水果 C++ Wrong Answer 1 MS 308 KB 1051 2025-07-06 15:29:38

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 a[10000]={0},c=0,k,ai,n,m,num=0; cin>>n; for(int i=0;i<n;i++){ num=0; cin>>m; for(int j=1;j<m;j++){ cin>>k; a[k]++; } for(int j=0;j<10000;j++){ if(a[j]>0){ if(num<a[j]){ num=a[j]; } } } if(m%2==0){ if(num<=m/2){ cout<<"Y"<<endl; } else{ cout<<"N"<<endl; } } else if(m%2!=0){ if(num<=(m/2+1)){ cout<<"Y"<<endl; } else{ cout<<"N"<<endl; } } num=0; } 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