📄 problem 2208.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=2208 -->
<HTML><HEAD><TITLE>Problem 2208</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 2208.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>To and Fro</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> 1953 <FONT color=green>Accepted
Submit:</FONT> 1341 </CENTER>
<HR>
<P>Mo and Larry have devised a way of encrypting messages. They first decide
secretly on the number of columns and write the message (letters only) down the
columns, padding with extra random letters so as to make a rectangular array of
letters. For example, if the message is “There’s no place like home on a snowy
night” and there are five columns, Mo would write down</P>
<P>t o i o y<BR>h p k n n<BR>e l e a i<BR>r a h s g<BR>e c o n h<BR>s e m o
t<BR>n l e w x<BR></P>
<P>Note that Mo includes only letters and writes them all in lower case. In this
example, Mo used the character ‘x’ to pad the message out to make a rectangle,
although he could have used any letter.</P>
<P>Mo then sends the message to Larry by writing the letters in each row,
alternating left-to-right and right-to-left. So, the above would be encrypted
as</P>
<P>toioynnkpheleaigshareconhtomesnlewx</P>
<P>Your job is to recover for Larry the original message (along with any extra
padding letters) from the encrypted one.</P>
<P><B>Input</B></P>
<P>There will be multiple input sets. Input for each set will consist of two
lines. The first line will contain an integer in the range 2. . . 20 indicating
the number of columns used. The next line is a string of up to 200 lower case
letters. The last input set is followed by a line containing a single 0,
indicating end of input.</P>
<P><B>Output</B></P>
<P>Each input set should generate one line of output, giving the original
plaintext message, with no spaces.</P>
<P><B>SampleInput</B></P>
<P>5<BR>toioynnkpheleaigshareconhtomesnlewx<BR>3<BR>ttyohhieneesiaabss<BR>0<BR></P>
<P><B>SampleOutput</B></P>
<P>theresnoplacelikehomeonasnowynightx<BR>thisistheeasyoneab<BR></P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>East Central North America
2004</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=2208">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=13">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=2208">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 + -