| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 84521 | 尚雨钒 | 19选班长II | C++ | Accepted | 1 MS | 276 KB | 528 | 2024-07-16 09:51:41 |
#include<bits/stdc++.h> #include <cmath> using namespace std; int main() { int a=0,b=0,c=0; int x,sum=0; for(int i=0; i<1000; i++) { cin>>x; if(x==1){ a++; } if(x==2){ b++; } if(x==3){ c++; } if(x==-1){ break; }else{ sum++; } } cout<<"A="<<a<<endl<<"B="<<b<<endl<<"C="<<c<<endl<<"Tot="<<sum<<endl; if(a>sum/2){ cout<<"A-yes"; } else if(b>sum/2){ cout<<"B-yes"; } else if(c>sum/2){ cout<<"C-yes"; }else{ cout<<"all-NO"; } return 0; }