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 |
这个怎么不对啊#include<stdio.h> int main() { int page,x,p,n,t; while(scanf("%d",&n)&&n!=0) { t=1; printf("Printing order for %d pages:\n",n); if(n%2==0) { if(n%4!=0) { if(n==1) printf("Sheet 1, front: Blank, 1\n"); else { p=n/4+1; printf("Sheet 1, front: Blank, 1\n"); printf("Sheet 1, back : 2, Blank\n"); x=4*p-2; for(int i=0;i<n/4;i++) { printf("Sheet %d, front: %d, %d\n",i+2,x,4*p-x+1); printf("Sheet %d, back : %d, %d\n",i+2,4*p-x+2,x-1); x=x-2; } } } else { x=n; for(int i=0;i<n/4;i++) { printf("Sheet %d, front: %d, %d\n",i+1,x,t); t++; printf("Sheet %d, back : %d, %d\n",i+1,t,x-1); t++; x=x-2; } } } else { if((n+1)%4==0) { n=n+1; x=n; for(int i=0;i<n/4;i++) { if(i==0) { printf("Sheet %d, front: Blank, %d\n",i+1,t); } else { printf("Sheet %d, front: %d, %d\n",i+1,x,t); } t++; printf("Sheet %d, back : %d, %d\n",i+1,t,x-1); t++; x=x-2; } } else { n=n-1; x=n; printf("Sheet 1, front: Blank, 1\n"); printf("Sheet 1, back : 2, Blank\n"); for(int i=1;i<n/4+1;i++) { if(i==1) { printf("Sheet 2, front: Blank, 3\n"); } else { printf("Sheet %d, front: %d, %d\n",i+1,x+2,t+2); } t++; printf("Sheet %d, back : %d, %d\n",i+1,t+2,x-1+2); t++; x=x-2; } } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator