-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
array_fill_4.cpp
42 lines (29 loc) · 931 Bytes
/
array_fill_4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// https://www.urionlinejudge.com.br/judge/en/problems/view/1179
#include <iostream>
#include <vector>
using namespace std;
bool is_full(vector<int> &v) {
if (v.size() == 5) return true;
return false;
}
int main() {
vector<int> even;
vector<int> odd;
int num;
for (int i = 0; i < 15; i++) {
cin >> num;
if (num % 2 == 0) even.push_back(num);
else odd.push_back(num);
if (is_full(odd)) {
for (int j = 0; j < 5; j++) cout << "impar[" << j << "] = " << odd[j] << endl;
odd.clear();
}
if (is_full(even)) {
for (int j = 0; j < 5; j++) cout << "par[" << j << "] = " << even[j] << endl;
even.clear();
}
}
for (int o_index = 0; o_index < odd.size(); o_index++) cout << "impar[" << o_index << "] = " << odd[o_index] << endl;
for (int e_index = 0; e_index < even.size(); e_index++) cout << "par[" << e_index << "] = " << even[e_index] << endl;
return 0;
}