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

为什么回WRONG ANSWER

Posted by mao19880106 at 2008-09-09 20:55:19 on Problem 1313
#include<iostream>
using namespace std;
void fun0(int k)
{
	int i=1;
	int n=k;
	int j=i;
	for(  i ; i <(k/4)+1;i++ )
			{
			cout<<"Printing order for "<<k<<" pages:"<<endl;
			cout<<"Sheet "<<i<<", front: "<<n--<<", "<<j++<<endl;
			cout<<"Sheet "<<i<<", back : "<<j++<<", "<<n--<<endl;
			}
}
void fun1(int k)
{
	cout<<"Printing order for "<<k<<" pages:"<<endl;
	cout<<"Sheet 1, front: Blank, 1"<<endl;

	int i=2;
	int n=k;
	int j=i;
	for(   i ; i <=(k/4)+1;i++ )
			{
			cout<<"Sheet "<<i-1<<", back : "<<j++<<", "<<n--<<endl;	
			cout<<"Sheet "<<i<<", front: "<<n--<<", "<<j++<<endl;
		
			}
}
void fun2(int k)
{
	cout<<"Printing order for "<<k<<" pages:"<<endl;
	cout<<"Sheet 1, front: Blank, 1"<<endl;
	cout<<"Sheet 1, back : 2, Blank"<<endl;
	int i=2;
	int n=k;
	int j=i+1;
	for(   i ; i <=(k/4)+1;i++ )
			{
			cout<<"Sheet "<<i<<", front: "<<n--<<", "<<j++<<endl;	
			cout<<"Sheet "<<i<<", back : "<<j++<<", "<<n--<<endl;
		
			}
}
void fun3(int k)
{
	cout<<"Printing order for "<<k<<" pages:"<<endl;
	cout<<"Sheet 1, front: Blank, 1"<<endl;
	cout<<"Sheet 1, back : 2, Blank"<<endl;
	cout<<"Sheet 2, front: Blank, 3"<<endl;
	int i=2;
	int n=k;
	int j=i+2;
	for(   i ; i <=(k/4)+1;i++ )
			{
			cout<<"Sheet "<<i<<", back : "<<j++<<", "<<n--<<endl;	
			cout<<"Sheet "<<i+1<<", front: "<<n--<<", "<<j++<<endl;
		
			}
}
int main()
{
	for(int i=0;;i++)
	{
		int k;
		cin>>k;

		if(k==0)
			break;
		if(k%4==0)
			fun0(k);
		if(k%4==1)
			fun1(k);
		if(k%4==2)
			fun2(k);
		if(k%4==3)
			fun3(k);
	}
	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