Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
84553 赵文浚 19选班长II C++ Accepted 1 MS 272 KB 515 2024-07-16 10:24:02

Tests(10/10):


Code:

#include<iostream> using namespace std; int a[4]; int main(){ int k; int n=0; while(1){ cin>>k; if(k==-1){ break; } n++; if(k>0&&k<4){ a[k]++; } } cout<<"A="<<a[1]<<endl; cout<<"B="<<a[2]<<endl; cout<<"C="<<a[3]<<endl; cout<<"Tot="<<n<<endl; if(a[1]>(n/2)) { cout<<"A-yes"; } else if(a[2]>(n/2)) { cout<<"B-yes"; } else if(a[3]>(n/2)) { cout<<"C-yes"; } else { cout<<"all-NO"; } return 0; }