📄 problem 1178.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=1178 -->
<HTML><HEAD><TITLE>Problem 1178</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<CENTER><IMG src="Problem 1178.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>Booklet Printing</FONT></CENTER>
<HR>
<CENTER><FONT color=green>Time limit:</FONT> 1 Seconds <FONT
color=green>Memory limit: </FONT>32768K </FONT><BR><FONT
color=green>Total Submit:</FONT> 1343 <FONT color=green>Accepted
Submit:</FONT> 644 </CENTER>
<HR>
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.
<P>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. </P>
<P>Front
Back<BR>------------- -------------<BR>| |
| |
| |<BR>| 4 | 1
| | 2 | 3 |<BR>| |
| | |
|<BR>------------- -------------</P>
<P>Your task is to write a program that takes as input the number of pages to be
printed, then generates the printing order. </P>
<P><BR><B>Input</B><BR><BR>The input contains one or more test cases, followed
by a line containing the number 0 that indicates the end of the file.
<BR><BR>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. </P>
<P><BR><B>Output </B><BR><BR>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.<BR><BR>Output must be
in ascending order by sheet, front first, then back. </P>
<P><BR><B>Sample Input </B></P>
<P>1<BR>14<BR>4<BR>0</P>
<P><BR><B>Sample Output </B><BR><BR>Printing order for 1 pages:<BR>Sheet 1,
front: Blank, 1<BR>Printing order for 14 pages:<BR>Sheet 1, front: Blank,
1<BR>Sheet 1, back : 2, Blank<BR>Sheet 2, front: 14, 3<BR>Sheet 2, back : 4,
13<BR>Sheet 3, front: 12, 5<BR>Sheet 3, back : 6, 11<BR>Sheet 4, front: 10,
7<BR>Sheet 4, back : 8, 9<BR>Printing order for 4 pages:<BR>Sheet 1, front: 4,
1<BR>Sheet 1, back : 2, 3<BR></P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>Mid-Central USA 1998</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=1178">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=2">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=1178">Status</A> </CENTER>
<HR>
<CENTER>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=right width="65%"><A href="http://acm.zju.edu.cn/"><FONT
color=red>Zhejiang University Online Judge</FONT></A> <A
href="http://acm.zju.edu.cn/"><FONT color=red>V1.0</FONT></A></TD>
<TD align=right width="35%"><A href="http://www.zzhang.cn/"><FONT
color=#ffffff
size=-3>Book</FONT></A></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -