Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
71845 刘世杰 19老李吃水果 C++ Compile Error 0 MS 0 KB 664 2024-04-27 17:39:57

Tests(0/0):


Code:

# include<iostream> using namespace std; int main(){ int i,j,n,m,k,max = 0; cin >> n; for(int i = 0;i < n;i++){ max = 0; cin >> m; for(j = 0;j < m;j++){ int arr[10000] = {0}; cin >> k; arr[k]++; } for(j = 0;j < 10000;j++){ if(arr[j] > 0){ if(max < arr[i]) max = arr[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; } max = 0; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:15:12: error: 'arr' was not declared in this scope
         if(arr[j] > 0){
            ^
Main.cc:4:5: warning: unused variable 'i' [-Wunused-variable]
 int i,j,n,m,k,max = 0;
     ^