Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
116983 | 陈奕涵 | 19选班长II | C++ | Accepted | 1 MS | 280 KB | 817 | 2025-04-13 09:39:46 |
#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 ar[10001],a=0,b=0,c=0,i=0,n=0; while(1){ cin>>ar[i]; if(ar[i]==-1)break; i++; n++; } for(i=0;i<n;i++){ if(ar[i]==1)a++; else if(ar[i]==2)b++; else if(ar[i]==3)c++; } cout<<"A="<<a<<endl; cout<<"B="<<b<<endl; cout<<"C="<<c<<endl; cout<<"Tot="<<n<<endl; if(a>n/2) cout<<"A-yes"<<endl; else if(b>n/2) cout<<"B-yes"<<endl; else if(c>n/2) cout<<"C-yes"<<endl; else cout<<"all-NO"<<endl; return 0; }