Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
77058 邓嘉瑶 19老李吃水果 C++ Wrong Answer 1 MS 316 KB 464 2024-06-08 10:31:40

Tests(0/5):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int k; cin>>k; while(k--){ int n; cin>>n; int t[10001]={0},sg; for(int i=1;i<=n;i++){ cin>>sg; t[sg]++; } int mx=0; for(int i=1;i<=n;i++){ if(t[i]>mx){ mx=t[i]; } } if(n%2==0){ if(mx<=n/2){ cout<<"Y"; }else{ cout<<"N"; } }else{ if(mx<=n/2+1){ cout<<"Y"; }else{ cout<<"N"; } } } 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-----
YNNNN