| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 121088 | 翁思宸 | 19选班长II | C++ | Wrong Answer | 1 MS | 272 KB | 1338 | 2025-06-06 19:14:45 |
/* //1403 19选班长 #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[11]={0},n,x=0,max=0,max_i=0; cin>>n; for(int i=1;i<=n*3;i++){ cin>>x; a[x]++; } for(int j=1;j<=10;j++){ if(a[j]>max){ max=a[j]; max_i=j; } } cout<<max_i; return 0; }*/ //1404 19选班长II #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=0,b=0,c=0,ai[4]={0},t=0,x=0; cin>>x; ai[x]++; while(x!=-1){ cin>>x; t++; ai[x]++; } a=ai[1]; b=ai[2]; c=ai[3]; t--; cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<t<<endl; if(a>t/2){ cout<<"A-yes"; } else if(b>t/2){ cout<<"B-yes"; } else if(c>t/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=43 all-NO