水题,看看sample就能找出规律,然后就没难度
#include<stdio.h>
int main()
{
int n;
while (scanf("%d", &n), n)
{
int sheet = n % 4 ? n / 4 + 1 : n / 4;
printf("Printing order for %d pages:\n", n);
int i;
for (i = 1; i <= sheet; i++)
{
printf("Sheet %d, front: ", i);
if (4 * sheet - 2 * i + 2 <= n)
printf("%d", 4 * sheet - 2 * i + 2);
else
printf("Blank");
printf(", %d\n", 2 * i - 1);
int a = 2 * i, b = 4 * sheet + 1 - 2 * i;
if (a <= n && b <= n)
printf("Sheet %d, back : %d, %d\n", i, a, b);
else if (a <= n)
printf("Sheet %d, back : %d, Blank\n", i, a);
}
}
return 0;
}