Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
107613 刘佳宇 19选班长II C++ Accepted 1 MS 272 KB 690 2025-01-18 10:46:15

Tests(10/10):


Code:

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