Run ID:73256

提交时间:2024-05-18 14:10:39

#include<bits/stdc++.h> using namespace std; int a[4]; int main(){ int k;//k是计那些是有效和无效 int n=0;//n是投票的人数 int b=0,c=0,d=0; while(1){ cin>>k; if(k==-1){ break; } n++; if(k>0&&k<4){ a[k]++; } if(k==1){ b++; } if(k==2){ c++; } if(k==3){ d++; } } cout<<"A="<<b<<endl; cout<<"B="<<c<<endl; cout<<"c="<<d<<endl; cout<<"Tot="<<n<<endl; if(b>n/2){ cout<<"A-yes"; } if(c>n/2){ cout<<"B-yes"; } if(d>n/2){ cout<<"C-yes"; } else{ cout<<"all-NO"; } return 0; }