Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
123500 朱安然 19选班长II C++ Compile Error 0 MS 0 KB 631 2025-07-05 12:49:32

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a1 = 0; int a2 = 0; int a3 = 0; int x; if (x == 1) { a1++; } if (x == 2) { a2++; } if (x == 3) { a3++; }x int total = 1; while (x != -1) { cin >> x; if (x != -1) { total++; } if (x == 1) { a1++; } if (x == 2) { a2++; } if (x == 3) { a3++; } } cout<<"A="<<a1<<endl; cout<<"B="<<a2<<endl; cout<<"C="<<a3<<endl; cout<<"Tot="<<total; if(a1*2>x){ cout<<"A-yes"; }else if(a2*2>x){ cout<<"B-yes"; }else if(a3*2>x){ cout<<"C-yes"; }else{cout<<"all-NO";} return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:17:2: error: expected ';' before 'int'
  int total = 1;
  ^
Main.cc:17:15: warning: statement has no effect [-Wunused-value]
  int total = 1;
               ^
Main.cc:21:4: error: 'total' was not declared in this scope
    total++;
    ^
Main.cc:36:16: error: 'total' was not declared in this scope
  cout<<"Tot="<