Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
100752 | 吕毅心 | 19选班长II | C++ | Accepted | 1 MS | 272 KB | 725 | 2024-12-12 19:13:14 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() using namespace std; int main(){ int a[4]={},x,Tot=0; for(int i=1;;i++){ cin>>x; if(x==1){ a[1]++; }else if(x==2){ a[2]++; }else if(x==3){ a[3]++; }else if(x==-1){ break; } Tot++; } cout<<"A="<<a[1]<<endl<<"B="<<a[2]<<endl<<"C="<<a[3]<<endl<<"Tot="<<Tot<<endl; if(a[1]>Tot/2){ cout<<"A-yes"; }else if(a[2]>Tot/2){ cout<<"B-yes"; }else if(a[3]>Tot/2){ cout<<"C-yes"; }else{ cout<<"all-NO"; } return 0; }