forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymmetricorder.cpp
44 lines (40 loc) · 907 Bytes
/
symmetricorder.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
43
44
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int n;
int j = 0;
while(cin >> n && n != 0) {
j++;
vector<string> v;
for(int i = 0; i < n; i++) {
string s;
cin >> s;
v.push_back(s);
}
cout << "SET " << j << endl;
if(v.size() % 2 == 1) {
// odd
int i = 0;
for(i; i < v.size(); i+=2) {
cout << v[i] << endl;
}
i -= 3;
for(i; i >= 0; i-=2) {
cout << v[i] << endl;
}
}
else {
// even
int i = 0;
for(i; i < v.size(); i+=2) {
cout << v[i] << endl;
}
i -= 1;
for(i; i >= 0; i-=2) {
cout << v[i] << endl;
}
}
}
}