USTC 1005 Booklet Printing
来源:互联网 发布:windows10视频剪辑软件 编辑:程序博客网 时间:2024/06/05 09:24
Problem 1005
Booklet Printing
Time Limit: 1000ms
Memory Limit: 65536kb
Memory Limit: 65536kb
Description
When printing out a document, normally the first page is printed first, then the second, then the third, and so on until the end. However, when creating a fold-over booklet, the order of printing must be altered. A fold-over booklet has four pages per sheet, with two on the front and two on the back. When you stack all the sheets in order, then fold the booklet in half, the pages appear in the correct order as in a regular book. For example, a 4-page booklet would print on 1 sheet of paper: the front will contain page 4 then page 1, and the back will contain page 2 then page 3.Front Back------------- -------------| | | | | || 4 | 1 | | 2 | 3 || | | | | |------------- -------------
Your task is to write a program that takes as input the number of pages to be printed, then generates the printing order.Input
The input contains one or more test cases, followed by a line containing the number 0 that indicates the end of the file. Each test case consists of a positive integer n on a line by itself, where n is the number of pages to be printed; n will not exceed 100.Output
For each test case, output a report indicating which pages should be printed on each sheet, exactly as shown in the example. If the desired number of pages does not completely fill up a sheet, then print the word Blank in place of a number. If the front or back of a sheet is entirely blank, do not generate output for that side of the sheet. Output must be in ascending order by sheet, front first, then back.Sample Input
11440
Sample Output
Printing order for 1 pages:Sheet 1, front: Blank, 1Printing order for 14 pages:Sheet 1, front: Blank, 1Sheet 1, back : 2, BlankSheet 2, front: 14, 3Sheet 2, back : 4, 13Sheet 3, front: 12, 5Sheet 3, back : 6, 11Sheet 4, front: 10, 7Sheet 4, back : 8, 9Printing order for 4 pages:Sheet 1, front: 4, 1Sheet 1, back : 2, 3
[Submit|Status|Discuss|Add to bookmark]
。。。。。。 -_-#
#include<stdio.h>#include<string.h>#define N 505#define L 0#define Y 1#define E 2#define S 4#define _M_ main()#define _ i#define __ n#define ___ k#define ____ num#define _____ [_]#define ______ [L]#define _______ [Y]#define ________ [E]#define _________ if(___>n) break;#define __________ page#define ___________ front#define ____________ back#define _____________ __________ _____.___________#define ______________ __________ _____.____________#define _______________ __________ _____.___________ ______#define ________________ __________ _____.___________ _______#define _________________ __________ _____.____________ ______#define __________________ __________ _____.____________ _______#define ___________________ ___++#define ____________________ _--#define _____________________ _++#define ______________________ %S#define _______________________ /S#define ________________________ _+Y#define _________________________ +Y#define __________________________ -Y#define ___________________________ =Y#define ____________________________ =L#define _____________________________ ==L#define ______________________________ >=L#define _______________________________ __ _______________________#define ________________________________ scanf#define _________________________________ printf#define __________________________________ memset#define ___________________________________ "Printing order for %d pages:\n"#define ____________________________________ "Sheet %d, front: Blank, %d\n"#define _____________________________________ "Sheet %d, front: %d, Blank\n"#define ______________________________________ "Sheet %d, front: %d, %d\n"#define _______________________________________ "Sheet %d, back : Blank, %d\n"#define ________________________________________ "Sheet %d, back : %d, Blank\n"#define _________________________________________ "Sheet %d, back : %d, %d\n"int _M_{struct{int ___________ ________;int ____________ ________;}__________[N];int _,__,___,____;while(________________________________("%d",&__),__){for(_ ____________________________;_<N;_____________________)__________________________________(_____________,L,sizeof(_____________)),__________________________________(______________,L,sizeof(______________));if(__ ______________________ _____________________________) ____=_______________________________;else ____=_______________________________ _________________________;___ ___________________________;for(_ ____________________________;_<____;_____________________){ ________________=___________________;_________ _________________=___________________;_________}for(_=____ __________________________;_ ______________________________;____________________){_________ __________________=___________________;_________ _______________=___________________;_________}_________________________________(___________________________________,__);for(_ ____________________________;_<____;_____________________){if(_______________||________________){if(_______________ _____________________________) _________________________________(____________________________________,________________________,________________);else if(________________ _____________________________) _________________________________(_____________________________________,________________________,_______________);else _________________________________(______________________________________,________________________,_______________,________________);}if(_________________||__________________){if(_________________ _____________________________) _________________________________(_______________________________________,________________________,__________________);else if(__________________ _____________________________) _________________________________(________________________________________,________________________,_________________);else _________________________________(_________________________________________,________________________,_________________,__________________);}}}return L;}
0 0
- USTC 1005 Booklet Printing
- 1313 Booklet Printing
- pku 1313 Booklet Printing
- UVa 637 - Booklet Printing
- zoj 1178 Booklet Printing
- POJ 1313 Booklet Printing
- 程序设计大赛—Booklet Printing
- POJ 1313 Booklet Printing 笔记
- hdu 1117 Booklet Printing(模拟 分类 水题)
- poj 1313 Booklet Printing 模拟水题
- ZOJ 1178 Booklet Printing(书本对折问题)
- booklet
- Exercise 9: Printing, Printing ,Printing
- Exercise 8: Printing ,Printing
- USTC 1117
- USTC 1344
- Booklet print 装订打印
- Printing Architecture
- iOS开发
- Java this的使用
- fork与vfork的区别
- 查找oracle比较慢的session和sql
- uva 10115 Automatic Editing(strstr+sprintf)
- USTC 1005 Booklet Printing
- poj 1562:Oil Deposits
- 课程设计
- Java 对象一对一
- 排序(1)---------选择排序(C语言实现)
- 8、大数,高精度计算---高精度幂次
- 字符串转换成整数
- -[__NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'
- 9、 大数,高精度计算---大数阶乘