Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
74162 谢绍澜 19老李吃水果 C++ Compile Error 0 MS 0 KB 811 2024-05-23 19:42:51

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:13: error: 'a' was not declared in this scope
             a[i]=0;
             ^
Main.cc:14:13: error: 'a' was not declared in this scope
             a[c]++;
             ^
Main.cc:17:20: error: 'a' was not declared in this scope
                 if(a[i]>max){
                    ^