| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 152542 | 徐英杰 | 19选班长II | C++ | Accepted | 1 MS | 268 KB | 854 | 2026-04-26 15:20:17 |
#include<iostream> using namespace std; int a[1000001]; int main() { //桶:按照某种性质将数据分组,满足相同性质的数据,放入同一个容器 //桶的作用1:统计满足某种性质的数据个数 // int cntA = 0; // int cntB = 0; // int cntC = 0; int tot = 0; int x; for (;;) { cin>>x; if (x == -1) { break; } tot++; a[x]++; } cout<<"A="<<a[1]<<endl; cout<<"B="<<a[2]<<endl; cout<<"C="<<a[3]<<endl; cout<<"Tot="<<tot<<endl; if (a[1] > tot/2) { cout<<"A-yes\n"; return 0; } if (a[2] > tot/2) { cout<<"B-yes\n"; return 0; } if (a[3] > tot/2) { cout<<"C-yes\n"; return 0; } cout<<"all-NO"; return 0; }