| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 123431 | 汤 | 19选班长II | C++ | Wrong Answer | 1 MS | 272 KB | 636 | 2025-07-01 11:09:11 |
#include<bits/stdc++.h> using namespace std; int main() { int p[10001],a=0,b=0,c=0,i=0,tot=0; while(1) { cin>>p[i]; if(p[i]==-1) { break; } i++; tot++; } for(i=0;i<=tot;i++) { if(p[i]==1) { a++; } if(p[i]==2) { b++; } if(p[i]==3) { c++; } } cout<<"a="<<a<<endl; cout<<"b="<<b<<endl; cout<<"c="<<c<<endl; cout<<"tot="<<tot<<endl; if(a>tot/2) { cout<<"A-yes"; } if(a>tot/2) { cout<<"A-yes"; } else if(b>tot/2) { cout<<"B-yes"; } else if(c>tot/2) { cout<<"C-yes"; } else { cout<<"ALL-NO"; } return 0; }
------Input------
4 3 4 2 1 3 1 4 1 4 1 2 1 3 3 1 3 4 3 1 4 4 4 4 4 4 4 4 1 1 4 4 1 2 4 3 4 2 1 2 1 3 3 3 -1
------Answer-----
A=12 B=5 C=10 Tot=44 all-NO
------Your output-----
a=12 b=5 c=10 tot=44 ALL-NO