Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
61243 李琥博 19选班长II C++ Wrong Answer 1 MS 272 KB 596 2023-12-03 11:38:33

Tests(1/10):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int x[4]={0}; int i=0,p; double s; int t=0; while(i>=0){ cin>>p; if(p<=3&&p>0){ x[p]++; } if(p==-1){ break; } i++; t++; } s=(double)t/2; int g=0; for(int i=1;i<=4;i++){ if(x[i]>s){ g=x[i]; } } printf("A=%d\n",x[1]); printf("B=%d\n",x[2]); printf("C=%d\n",x[3]); printf("Tot=%d\n",t); if(g==0){ printf("all-NO"); } else if(g==x[1]){ printf("A-yes"); } else if(g==x[2]){ printf("B-yes"); } else if(g==x[3]){ printf("C-yes"); } return 0; }


Run Info:

------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