| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 73258 | 孙睿阳 | 19选班长II | C++ | Accepted | 1 MS | 268 KB | 595 | 2024-05-18 14:11:14 |
#include<bits/stdc++.h> using namespace std; int a[4]; int main(){ int k;//k是计那些是有效和无效 int n=0;//n是投票的人数 int b=0,c=0,d=0; while(1){ cin>>k; if(k==-1){ break; } n++; if(k>0&&k<4){ a[k]++; } if(k==1){ b++; } if(k==2){ c++; } if(k==3){ d++; } } cout<<"A="<<b<<endl; cout<<"B="<<c<<endl; cout<<"C="<<d<<endl; cout<<"Tot="<<n<<endl; if(b>n/2){ cout<<"A-yes"; } if(c>n/2){ cout<<"B-yes"; } if(d>n/2){ cout<<"C-yes"; } else{ cout<<"all-NO"; } return 0; }