Run ID:87393

提交时间:2024-08-09 15:42:41

#include<iostream> using namespace std; int a[4]; int main() { int k; int n = 0; while (1) { cin >> k; if (k == -1) { break; } n++; if (k > 0 && k < 4) { a[k]++; } } cout << "A=" << a[1] << endl; cout << "B=" << a[2] << endl; cout << "C=" << a[3] << endl; cout << "Tot=" << n << endl; if (a[1] > (n / 2)) { cout << "A-yes"; } else if (a[2] > (n / 2)) { cout << "B-yes"; } else if (a[3] > (n / 2)) { cout << "C-yes"; } else { cout << "all-NO"; } return 0; }