Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:我的代码为啥会wa???(谁能帮忙看看)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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator