Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
111459 | 黎瑾萱 | 19选班长II | C++ | Accepted | 1 MS | 268 KB | 793 | 2025-03-02 11:27:40 |
#include <bits/stdc++.h> using namespace std; int h[10000]; int main() { int n,a=0,b=0,c=0,sum=0; while(1){ cin>>n; if(n==-1) break; sum++; if(n==1) a++; if(n==2) b++; if(n==3) c++; } int max=sum/2; if(a>max){ cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<sum<<endl; cout<<"A-yes"; } else if(b>max){ cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<sum<<endl; cout<<"B-yes"; } else if(c>max){ cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<sum<<endl; cout<<"C-yes"; } else{ cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<sum<<endl; cout<<"all-NO"; } return 0; }
------Input------
4 3 4 2 1 3 1 4 1 4 1 2 1 3 3 1 3 4 3 1 4 4 4 4 4 4 4 4 1 1 4 4 1 2 4 3 4 2 1 2 1 3 3 3 -1
------Answer-----
A=12 B=5 C=10 Tot=44 all-NO
------Your output-----