Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
71825 孙嘉言 19老李吃水果 C++ Wrong Answer 1 MS 316 KB 588 2024-04-27 17:19:21

Tests(2/5):


Code:

# include<iostream> using namespace std; int main(){ int i,j,n,m,k,xyx=0; int a[10000]={0}; cin>>n; for(i=0;i<n;i++){ xyx=0; cin>>m; for(j=0;j<m;j++){ cin>>k; a[k]++; } for(j=0;j<=1000;j++){ if(a[j]>0){ if(xyx<a[j]) xyx=a[j]; } } if(m%2==0){ if(xyx<=m/2) cout<<"Y"<<endl; else cout<<"N"<<endl; }else if(m%2!=0){ if(xyx<=(m/2+1)) cout<<"Y"<<endl; else cout<<"N"<<endl; }xyx=0; } return 0; } /* 2 6 1 2 4 2 2 4 5 1 1 1 2 1 */


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