15

朱安然  •  17天前


#include<bits/stdc++.h> 
using namespace std; 
int main() { 
int a1 = 0; 
int a2 = 0; 
int a3 = 0; 
int x; 
if (x == 1) { 
 a1++; 

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

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

int total = 0; 
while (x != -1) { 
 cin >> x; 
 if (x != -1) { 
  total++; 
 } 
 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=" << total; 

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

return 0; 
}


评论: