#include <iostream>
using namespace std;
int main() {
int x, e = 0, o = 0; //e == even, o == odd
for (int i = 0; i < 5; ++i) {
cin >> x;
if (x % 2) {
++o;
}
else {
++e;
if (e > o) {
cout << e << " " << o;
cout << -1;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main() {
int x, e = 0, o = 0; //e == even, o == odd
for (int i = 0; i < 5; ++i) {
cin >> x;
if (x % 2) {
++o;
}
else {
++e;
}
}
if (e > o) {
cout << e << " " << o;
}
else {
cout << -1;
}
return 0;
}