| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 116982 | 李朋秦 | 19选班长II | C++ | Wrong Answer | 1 MS | 276 KB | 529 | 2025-04-13 09:39:34 |
#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; }
------Input------
1 3 3 3 3 3 1 4 3 4 2 3 2 1 4 1 3 1 1 3 3 3 3 -1
------Answer-----
A=6 B=2 C=12 Tot=23 C-yes
------Your output-----
A=6 B=2 C=12 Tot=23 C-Yes