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 <iostream> #include <stdio.h> using namespace std; int n; void print(int k){ if(k <= n) printf("%d", k); else printf("Blank"); } bool isBlank(int k){ return k>n; } int main() { while(1){ scanf("%d", &n); if(!n) break; int K = (n+3)/4; printf("Printing order for %d pages:\n", n); for(int k = 1; k <= K; k++){ if(!isBlank(4*K+2-2*k) || !isBlank(2*k-1)){ printf("Sheet %d, front: ", k); print(4*K+2-2*k); printf(", "); print(2*k-1); printf("\n"); } if(!isBlank(2*k) || !isBlank(4*K+1-2*k)){ printf("Sheet %d, back : ", k); print(2*k); printf(", "); print(4*K+1-2*k); printf("\n"); } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator