Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108742 | 陈铎文 | 19选班长II | C++ | Accepted | 1 MS | 284 KB | 583 | 2025-01-21 15:54:55 |
#include<bits/stdc++.h> using namespace std; int main() { int a[10001],A=0,B=0,C=0,i=1,s=0; while(1){ cin>>a[i]; if(a[i]==-1) break; i++; s++; } for(int j=1;j<=s;j++){ if(a[j]==1) A++; else if(a[j]==2) B++; else if(a[j]==3) C++; } cout<<"A="<<A<<endl; cout<<"B="<<B<<endl; cout<<"C="<<C<<endl; cout<<"Tot="<<s<<endl; if(A > s/2){ cout<<"A-yes"<<endl; } else if(B > s/2){ cout<<"B-yes"<<endl; } else if(C > s/2){ cout<<"C-yes"<<endl; } else{ cout<<"all-NO"<<endl; } return 0; }