Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
97327 | Kevin | 19选班长II | C++ | Accepted | 1 MS | 264 KB | 693 | 2024-11-13 15:35:55 |
#include<bits/stdc++.h> using namespace std; int a[10005]; int main(){ int t=1,s,A=0,B=0,C=0,Tot; char jieguo; cin>>a[t]; while(a[t]!=-1){ t++; cin>>a[t]; } Tot=t-1; for(int i=1;i<t;i++){ if(a[i]==1) A++; if(a[i]==2) B++; if(a[i]==3) C++; } if(A>=(Tot/2.0)) jieguo='A'; else if(B>=(Tot/2.0)) jieguo='B'; else if(C>=(Tot/2.0)) jieguo='C'; else jieguo='N'; if(jieguo=='N') { cout<<"A="<<A<<endl; cout<<"B="<<B<<endl; cout<<"C="<<C<<endl; cout<<"Tot="<<Tot<<endl; cout<<"all-NO"; } else{ cout<<"A="<<A<<endl; cout<<"B="<<B<<endl; cout<<"C="<<C<<endl; cout<<"Tot="<<Tot<<endl; cout<<jieguo<<"-yes"; } return 0; }