不难得出,两部分相差不是0,就是1
设一个整数x,x+{x-3)=(x-1)+(x-2),所以我们将n和n-3放入第一部分,将n-1和n-2放入第二部分,n不断递减即可。
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
while(scanf("%lld",&n)!=EOF)
{
ll a=n*(n+1)/2%2;
printf("%lld\n",a);
printf("%lld",n/2);
for(ll i=n,j=0;i>1;i-=2,j=!j)
{
printf(" %lld",i-j);
}
printf("\n");
}
return 0;
}