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

水啊水啊水

Posted by KatrineYang at 2016-09-12 08:54:00 on Problem 1313
#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:
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