Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
96302 | 刘珩宇 | 19选班长II | C++ | Accepted | 1 MS | 272 KB | 762 | 2024-11-03 19:09:14 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int x,a=0,b=0,c=0,i,sum=0; while(1){ cin>>x; if(x==1){ a+=1; } else if(x==2){ b+=1; } else if(x==3){ c+=1; } else if(x==-1){ break; } sum++; } cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<sum<<endl; if(a>sum/2){ cout<<"A-yes"<<endl; } else if(b>sum/2){ cout<<"B-yes"<<endl; } else if(c>sum/2){ cout<<"C-yes"<<endl; } else{ cout<<"all-NO"<<endl; } return 0; }