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

Re:我的代码为啥会wa???(谁能帮忙看看)

Posted by ABLE at 2009-09-23 20:11:05 on Problem 1313
In Reply To:我的代码为啥会wa???(谁能帮忙看看) Posted by:123_456 at 2008-07-23 10:36:18
> #include<stdio.h>
> int main()
> {
> 	int n,j,page;
> 	while(1)
> 	{
> 		scanf("%d",&n);
> 		if(n==0)
> 			break;
> 		printf("Printing order for %d pages:\n",n);
> 		if(n%4==1)
> 		{
> 			page=n/4+1;
> 			if(n==1)
> 				printf("Sheet 1, front: Blank, 1\n");
> 			else
> 			{
> 				for(j=1;j<=page;j++)
> 				{
> 					if(j==1)
> 					{
> 						printf("Sheet %d, front: Blank, %d\n",j,2*j-1);
> 						printf("Sheet %d, back : %d, Blank\n",j,2*j);
> 					}
> 					else if(j==2)
> 					{
> 							printf("Sheet %d, front: Blank, %d\n",j,2*j-1);
> 							printf("Sheet %d, back : %d, %d\n",j,2*j,n);
> 					}
> 					else 
> 					{
> 						printf("Sheet %d, front: %d, %d\n",n+5-j*2,j,2*j-1);
> 						printf("Sheet %d, back : %d, %d\n",j,2*j,n+4-j*2);
> 					}					
> 				}
> 			}
> 		}
> 		else if(n%4==2)
> 		{
> 			page=n/4+1;
> 			for(j=1;j<=page;j++)
> 			{
> 				if(j==1)
> 				{
> 					printf("Sheet 1, front: Blank, 1\n");
> 			        printf("Sheet 1, back : 2, Blank\n");
> 				}
> 				else
> 				{
> 					printf("Sheet %d, front: %d, %d\n",j,n+4-2*j,2*j-1);
> 					printf("Sheet %d, back : %d, %d\n",j,2*j,n+3-2*j);
> 				}
> 			}			
> 		}
> 		else if(n%4==3)
> 		{
> 			page=n/4+1;
> 			for(j=1;j<=page;j++)
> 			{
> 				if(j==1)
> 				{
> 					printf("Sheet 1, front: Blank, 1\n");
> 					printf("Sheet 1, back : 2, %d\n",n);
> 				}
> 				else
> 				{
> 					printf("Sheet %d, front: %d, %d\n",j,n+3-2*j,2*j-1);
> 					printf("Sheet %d, back : %d, %d\n",j,2*j,n+2-2*j);
> 				}
> 			}
> 		}
> 		else
> 		{
> 			page=n/4;
> 			for(j=1;j<=page;j++)
> 			{
> 				printf("Sheet %d, front: %d, %d\n",j,n+2-2*j,2*j-1);
> 				printf("Sheet %d, back : %d, %d\n",j,2*j,n+1-2*j);
> 			}
> 		}
> 	}
> 	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