-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path10656.cpp
More file actions
46 lines (37 loc) · 641 Bytes
/
10656.cpp
File metadata and controls
46 lines (37 loc) · 641 Bytes
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
43
44
45
46
#include <iostream>
#include <vector>
#include <cstdint>
using namespace std;
void _solve();
int64_t numInput;
int64_t temp;
vector<int64_t> numbers;
int main() {
while (cin >> numInput) {
if (numInput != 0) {
_solve();
}
}
return 0;
}
void _solve() {
numbers.clear();
numbers.reserve(numInput);
for (int64_t i = 0; i < numInput; i++) {
cin >> temp;
if (temp != 0) {
numbers.push_back(temp);
}
}
if (numbers.size() == 0) {
cout << 0 << endl;
} else {
for (int64_t i = 0; i < numbers.size(); i++) {
cout << numbers[i];
if ((i + 1) != numbers.size()) {
cout << " ";
}
}
cout << endl;
}
}