Pagini recente » Cod sursa (job #2625945) | Cod sursa (job #3201845) | Cod sursa (job #502574) | Cod sursa (job #1258881) | Cod sursa (job #183016)
Cod sursa(job #183016)
#include <stdio.h>
long n,i,d;
int main()
{
freopen("multimi2.in","r",stdin);
freopen("multimi2.out","w",stdout);
scanf("%ld",&n);
if (n%4==1){d=(n-1)/4;
printf("1\n%ld\n1 ",n/2+1);
for(i=1;i<=d;i++)printf("%ld %ld ",2+i-1,n+2-(2+i-1));
printf("\n%ld\n",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",2+d+i-1,n+2-(2+d+i-1));
}
else if (n%4==2){d=(n-2)/4;
printf("1\n%ld\n1 ",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",3+i-1,n+3-(3+i-1));
printf("\n%ld\n2 ",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",3+d+i-1,n+3-(3+d+i-1));
}
else if(n%4==3){
d=(n-3)/4;
printf("0\n%ld\n1 2 ",n/2+1);
for(i=1;i<=d;i++)printf("%ld %ld ",4+i-1,n+4-(4+i-1));
printf("\n%ld\n3 ",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",4+d+i-1,n+4-(4+d+i-1));
}
else {
d=n/4;
printf("0\n%ld\n",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",i,n+1-i);
printf("\n%ld\n",n/2);
for(i=1;i<=d;i++)printf("%ld %ld ",d+i,n+1-(d+i));
}
return 0;
}