poj 1313 Booklet Printing 模拟水题

//poj 1314
//sep9
#include 
using namespace std;
const int MAXN=128;
struct Page{
	int front1,front2;
	int back1,back2;
}pages[MAXN];
int n;
void print(int x)
{
	if(x>n) printf(" Blank");
	else printf(" %d",x);
}

int main()
{
    while(scanf("%d",&n)==1&&n){
		int num=n%4==0?n/4:n/4+1;
		printf("Printing order for %d pages:\n",n);
		int cnt=0;
		for(int i=0;i=0;--i){
			pages[i].back2=++cnt;
			pages[i].front1=++cnt;	
		}	
		for(int i=0;in&&pages[i].back2>n)
				continue;
			printf("Sheet %d, back :",i+1);
			print(pages[i].back1);
			printf(",");
			print(pages[i].back2);
			puts("");
		}
    }	
	return 0;	
}

你可能感兴趣的:(杂题)