Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
118756 陈骏睿 19老李吃水果 C++ Runtime Error 0 MS 272 KB 831 2025-05-10 11:52:27

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


Run Info:

Runtime Error:Segmentation fault