Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
7101 | 谢锦卓 | 19选班长II | C++ | Wrong Answer | 0 MS | 260 KB | 789 | 2025-04-05 09:28:16 |
#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 a[4]={}; int p; int cnt=0; while(1){ cin>>p; if(p==-1)break; a[p]++; cnt++; } int _max=0; char w; for(int i=1;i<=3;i++){ if(a[i]>_max){ _max=a[i]; w=i-1+'A'; } } cout<<"A="<<a[1]<<endl; cout<<"B="<<a[2]<<endl; cout<<"C="<<a[3]<<endl; cout<<"Tot="<<cnt<<endl; if(_max>cnt/2){ cout<<w<<"-yes"<<endl; } else{ cout<<w<<"all-No"<<endl; } return 0; }
------Input------
1 3 3 1 1 1 2 1 4 4 3 4 1 3 2 3 1 2 3 4 4 2 1 1 4 4 2 4 3 3 3 4 4 2 2 3 1 1 2 1 4 2 3 -1
------Answer-----
A=12 B=9 C=11 Tot=43 all-NO
------Your output-----
A=12 B=9 C=11 Tot=43 Aall-No