Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
75965 邓嘉懿 19选班长II C++ Accepted 1 MS 272 KB 496 2024-06-01 11:39:54

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int t[4]={0},tot=0; int p; while(1){ cin>>p; if(p==-1){ break; } tot++; if(p>=1&&p<=3){ t[p]++; } } cout<<"A="<<t[1]<<endl; cout<<"B="<<t[2]<<endl; cout<<"C="<<t[3]<<endl; cout<<"Tot="<<tot<<endl; if(t[1]>tot/2){ cout<<"A-yes"; return 0; } if(t[2]>tot/2){ cout<<"B-yes"; return 0; } if(t[3]>tot/2){ cout<<"C-yes"; return 0; } cout<<"all-NO"; return 0; }