Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
116984 | 李朋秦 | 19选班长II | C++ | Accepted | 1 MS | 280 KB | 529 | 2025-04-13 09:40:08 |
#include<bits/stdc++.h> using namespace std; int main(){ int A[10001],a=0,b=0,c=0,i=0,n=0; while(1){ cin>>A[i]; if(A[i]==-1)break; i++; n++; } for(int j=0;j<n;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="<<n<<endl; if(a>n/2){ cout<<"A-yes"<<endl; }else if(b>n/2){ cout<<"B-yes"<<endl; }else if(c>n/2){ cout<<"C-yes"<<endl; }else{ cout<<"all-NO"<<endl; } return 0; }