Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
96304 吴诗涵 19选班长II C++ Accepted 1 MS 272 KB 614 2024-11-03 19:11:15

Tests(10/10):


Code:

#include<iostream> using namespace std; int main(){ int n,e[100]={0},i=0,a=0,b=0,c=0; while(1){ cin>>e[i]; if(e[i]==-1){ break; } i++; } for(int h=0;h<=i;h++){ if(e[h]==1){ a++; } else if(e[h]==2){ b++; } else if(e[h]==3){ c++; } } cout<<"A="<<a<<endl<<"B="<<b<<endl<<"C="<<c<<endl<<"Tot="<<i<<endl; if(a>=i/2){ cout<<"A-yes"; } else if(b>=i/2){ cout<<"B-yes"; } else if(c>=i/2){ cout<<"C-yes"; } else{ cout<<"all-NO"; } return 0; }