| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 122295 | 程诺 | 19选班长II | C++ | Compile Error | 0 MS | 0 KB | 682 | 2025-06-15 10:38:35 |
#include<iostream> using namespace std; int main(){ /** int n,m; cin>>n; int a[n+1]={0}; for(int i = 1;i<=n;i++){ for(int j = 1;j<=3;j++){ cin>>m; a[m]++; } } int max = a[1],j=1; for(int i = 2;i<=n;i++){ if(max < a[i]){ max = a[i]; j = i; } } cout<<j; **/ int n=0,a[4]={0},s; while(true){ cin>>s; if(s == -1){ break; } a[s]++; j++; n++; } cout<<"A="<<a[1]<<endl; cout<<"B="<<a[2]<<endl; cout<<"C="<<a[3]<<endl; cout<<"Tot="<<n<<endl; if(a[1]>n/2){ cout<<"A-yes"; }else if(a[2]>n/2){ cout<<"B-yes"; }else if(a[3]>n/2){ cout<<"C-yes"; }else{ cout<<"all-NO"; } return 0; }
Main.cc: In function 'int main()': Main.cc:29:3: error: 'j' was not declared in this scope j++; ^