Untitled
#include <iostream> using namespace std; int main() { int a, d, b = 0, c = 0; cin >> a; for (int i = 0; i < a; i++) { cin >> d; if (d == 1) { b += 1; } if (d == 0) { c += 1; } } if (b > c) { cout << c; } else { cout << b; } }
#include <iostream> using namespace std; int main() { int a, d, b = 0, c = 0; cin >> a; for (int i = 0; i < a; i++) { cin >> d; if (d == 1) { b += 1; } if (d == 0) { c += 1; } } if (b > c) { cout << c; } else { cout << b; } }