找规律
求最小值 只需要从大到小排列(从1开始 最小值的规律是1 1 0 0 1 1 0 0 … )
求最大值 只需要将最大的N放在最后一个 前面N-1个 是 MID,MID+1,…,N-1,MID-1,… 1即可
从1开始 最大值规律是 i i-1 i-1 i i i-1 i-1 …
找规律即可得 得到如下代码
n = int(input())
for _ in range(n):
N = int(input())
if N%2==0:
minres = 0 if (N//2)%2 == 0 else 1
maxres = N if (N//2)%2 == 0 else N-1
elif N%2 == 1:
minres = 0 if ((N+1)//2) % 2 == 0 else 1
maxres = N if N == 1 or (N-1)//2%2 == 0 else N-1
print(minres,maxres)