答案

郭玉洁  •  17天前


#include<bits/stdc++.h> 
using namespace std; 
int main() 

int a1=0; 
int a2=0; 
int a3=0; 
int x; 
cin>>x; 
if (x==1){ 
a1++; 

if(x==2){ 
a2++; 

if(x==3){ 
a3++; 

int tot=1; 
while(x!=-1){ 
cin>>x; 
if(x!=-1){ 
 tot++; 

if (x==1){ 
 a1++; 

if(x==2){ 
 a2++; 

if(x==3){ 
 a3++; 

}  
cout<<"A="<<a1<<endl; 
cout<<"B="<<a2<<endl; 
cout<<"C="<<a3<<endl; 
cout<<"Tot="<<tot<<endl; 
if(a1*2>tot){ 
cout<<"A-yes"; 
}else if(a2*2>tot){ 
cout<<"B-yes"; 
}else if(a3*2>tot){ 
cout<<"C-yes"; 
}else{ 
cout<<"all-NO" ; 

return 0; 
}


评论: