-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdivbyi.cpp
More file actions
37 lines (36 loc) · 741 Bytes
/
divbyi.cpp
File metadata and controls
37 lines (36 loc) · 741 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
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
// your code goes here
int z;
cin >> z;
while (z--)
{
ll int num, t = 0;
cin >> num;
int arr[num];
t = num;
arr[num - 1] = num;
for (int j = 1; j < num; j++)
{
if (j % 2 != 0)
{
arr[num - 1 - j] = t - (num - j);
t = arr[num - 1 - j];
}
else
{
arr[num - 1 - j] = t + (num - j);
t = arr[num - 1 - j];
}
}
for (int j = 0; j < num; j++)
{
cout << arr[j] << " ";
}
cout << "\n";
}
return 0;
}