Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
102448 欧阳俊懿 19选班长II C++ Wrong Answer 1 MS 312 KB 953 2024-12-21 16:32:55

Tests(0/10):


Code:

#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 i=0,j=0,n=0,A=0,B=0,C=0; int arr[10001]={0}; while(1) { cin >> arr[i]; if(arr[i]==-1) break; i++; n++; } for(i=0;i<n;i++) { if(arr[i]==1) { A++; } else if(arr[i]==2) { B++; } else if(arr[i]==3) { C++; } } cout<<"A="<<A<<endl; cout<<"B="<<A<<endl; cout<<"C="<<A<<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; }


Run Info:

------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=12 C=12 Tot=44 all-NO