Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

zen me bu dui

Posted by liyunyu at 2009-08-01 15:08:19 on Problem 1313
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	int n;
	while ( cin >> n && n!=0  )
	{		
		cout<<"Printing order for "<< n<<" pages:"<<endl;
		int k=0 ,i=0,a=0;
		k= n/4 ;
		a=n%4;
		if(a==0 && n>=4)
		{
			for(i=1 ; i<=k ;i++)
			{
				printf("Sheet %d, front: %d, %d\n",i,4*k+2-2*i,2*i-1);
				printf("Sheet %d, back : %d, %d\n",i,2*i,4*k+1-2*i);
			}
		}		
		if(n==1)
		{
			cout<<"Sheet 1, front: Blank, 1"<<endl;
		}
		if(n==2)
		{
			cout<<"Sheet 1, front: Blank, 1"<<endl;
			cout<<"Sheet 1, back : 2, Blank"<<endl;
		}
		if(n==3)
		{
			cout<<"Sheet 1, front: Blank, 1"<<endl;
			cout<<"Sheet 1, back : 2, 3"<<endl;
		}		
		if(a==1 && n>4)
		{
            k++;
			cout<<"Sheet 1, front: Blank, 1"<<endl;
			cout<<"Sheet 1, back : 2, Blank"<<endl;
			cout<<"Sheet 2, front: Blank, 3"<<endl;
			cout<<"Sheet 2, Blank: 4, "<<n<<endl;
			for(i=3; i<=k ;i++)
			{
				printf("Sheet %d, front: %d, %d\n",i,4*k+2-2*i,2*i-1);
				printf("Sheet %d, back : %d, %d\n",i,2*i,4*k+1-2*i);
			}
		}
		if(a==2 && n>4)
		{
			k++;
			cout<<"Sheet 1, front: Blank, 1"<<endl;
			cout<<"Sheet 1, back : 2, Blank"<<endl;
			for(i=2; i<=k ;i++)
			{
				printf("Sheet %d, front: %d, %d\n",i,4*k+2-2*i,2*i-1);
				printf("Sheet %d, back : %d, %d\n",i,2*i,4*k+1-2*i);
			}
		}
		if(a==3 && n>4)
		{
			k++;
			cout<<"Sheet 1, front: Blank, 1"<<endl;
			cout<<"Sheet 1, back : 2, "<<n<<endl;
			for(i=2; i<=k ;i++)
			{
				printf("Sheet %d, front: %d, %d\n",i,4*k+2-2*i,2*i-1);
				printf("Sheet %d, back : %d, %d\n",i,2*i,4*k+1-2*i);
			}
		}		
	}
	return 0;
}










Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator