-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path1462A.cpp
More file actions
50 lines (47 loc) · 961 Bytes
/
Copy path1462A.cpp
File metadata and controls
50 lines (47 loc) · 961 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
47
48
49
50
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int t, len, c, c1;
cin >> t;
while (t--)
{
cin >> len;
int seq[len];
for (int i = 0; i < len; i++)
{
cin >> seq[i];
}
int ans[len];
c1 = 2;
c = 1;
ans[0] = seq[0];
if (len % 2 != 0)
{
for (int i = len - 1; i > len / 2; i--)
{
ans[c] = seq[i];
c += 2;
}
}
else
{
for (int i = len - 1; i >= len / 2; i--)
{
ans[c] = seq[i];
c += 2;
}
}
for (int i = 1; i < len - (len / 2); i++)
{
ans[c1] = seq[i];
c1 += 2;
}
for (int i = 0; i < len; i++)
{
cout << ans[i] << " ";
}
cout << "\n";
}
return 0;
}