Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
71799 LJY 19老李吃水果 C++ Wrong Answer 0 MS 312 KB 788 2024-04-27 17:02:35

Tests(0/5):


Code:

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


Run Info:

------Input------
5 6 1 2 4 2 2 4 5 1 1 1 2 1 5 1 1 1 2 1 5 1 1 1 2 1 5 1 1 1 2 1
------Answer-----
Y N N N N
------Your output-----
N