Run ID:77358

提交时间:2024-06-09 08:12:17

#include<bits/stdc++.h> using namespace std; int a=0,b=0,c=0,d=0; long long n=1; int main(){ while(d!=-1){ cin>>d; if(d==1){ a++; } if(d==2){ b++; } if(d==3){ c++; } n+=1; } if((n-2)%2!=0){ cout<<'A'<<'='<<a<<endl; cout<<'B'<<'='<<b<<endl; cout<<"C"<<'='<<c<<endl; cout<<"Tot"<<'='<<(n-2)<<endl; cout<<"all"<<'-'<<"NO"<<endl; } if(a>(n-2)/2){ cout<<'A'<<'='<<a<<endl; cout<<'B'<<'='<<b<<endl; cout<<"C"<<'='<<c<<endl; cout<<"Tot"<<'='<<(n-2)<<endl; cout<<"A"<<'-'<<"yes"<<endl; } if(b>(n-2)/2){ cout<<'A'<<'='<<a<<endl; cout<<'B'<<'='<<b<<endl; cout<<"C"<<'='<<c<<endl; cout<<"Tot"<<'='<<(n-2)<<endl; cout<<"B"<<'-'<<"yes"<<endl; } if(c>=n-2)/2){ cout<<'A'<<'='<<a<<endl; cout<<'B'<<'='<<b<<endl; cout<<"C"<<'='<<c<<endl; cout<<"Tot"<<'='<<(n-2)<<endl; cout<<"C"<<'-'<<"yes"<<endl; } return 0; }