Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
126911 刘宇帆 19选班长II C++ Compile Error 0 MS 0 KB 519 2025-07-22 14:24:24

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int a[4] = {0}, x, count = 0; double sum = 0; for (;;) { cin >> x; if (x == -1) { break; } a[x]++; count++; } sum = count / 2; cout << "A=" << a[1] << endl << "B=" << a[2] << endl << "C=" << a[3] << endl; cout << "Tot=" << count << endl; if () { } else if (a>sum) { cout<<"A="<<a[1]; } else if (b>sum) { cout<<"B="<<a[2]; }else if(c>sum){ cout<<"C="<<a[3]; } else cout << "all-No"; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:19:6: error: expected primary-expression before ')' token
  if () {
      ^
Main.cc:21:15: error: invalid operands of types 'int [4]' and 'double' to binary 'operator>'
  } else if (a>sum) {
               ^
Main.cc:23:13: error: 'b' was not declared in this scope
  } else if (b>sum) {
             ^
Main.cc:25:11: error: 'c' was not declared in this scope
  }else if(c>sum){
           ^