Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133381 刘益梵 19老李吃水果 C++ Compile Error 0 MS 0 KB 562 2025-10-18 16:40:39

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int a[11000]; int main(){ int k,n,t; cin>>k; while(k--){ //测试组数 cin>>n; memset(a,0,sizeof(a))//没次记得初始化为0 //统计每个数出现的次数 for(int i=1;i<=n;i++){ cin>>t; a[t]++ } //求出出现的最大次数 int max=0; for(int j=0;j<=10000;j++){ if(a[j]>max) max=a[j]; } //如果出现最大次数>半数一上,其他数将不能把出现最多的数全部分开 if(max>n/2+1) cout<<"N"<<endl; else cout<<"Y"<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:3: error: expected ';' before 'for'
   for(int i=1;i<=n;i++){
   ^
Main.cc:11:15: error: 'i' was not declared in this scope
   for(int i=1;i<=n;i++){
               ^
Main.cc:5:10: warning: unused variable 't' [-Wunused-variable]
  int k,n,t;
          ^