-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.cpp
More file actions
43 lines (43 loc) · 833 Bytes
/
B.cpp
File metadata and controls
43 lines (43 loc) · 833 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
#include<stdio.h>
int main()
{
int t, k, sum_even=0, sum_odd=0, n;
scanf("%d", &t);
for(int i=0; i<t; i++)
{
scanf("%d",&n);
for(int j=2; j<=n; j++)
{
sum_even+=j;
j++;
}
for(int j=1; j<n-1; j++)
{
sum_odd += j;
j++;
}
k=sum_even-sum_odd;
if(k%2 == 1)
{
printf("YES\n");
for(int j=2; j<=n; j++)
{
printf("%d ",j);
j++;
}
for(int j=1;j<n-1;j++)
{
printf("%d ",j);
j++;
}
printf("%d\n",k);
}
else
{
printf("NO\n");
}
sum_even=0;
sum_odd=0;
}
return 0;
}