📄 2818 -- 密码.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0035)http://poj.grids.cn/problem?id=2818 -->
<HTML><HEAD><TITLE>2818 -- 密码</TITLE>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="2818 -- 密码.files/poj.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="2818 -- 密码.files/poj.js"></SCRIPT>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY vLink=blue aLink=blue link=blue leftMargin=5><A name=top></A>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#ffffff width="100%"
border=1>
<TBODY>
<TR>
<TD
style="BACKGROUND-IMAGE: url(images/header.jpg); BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: right"
vAlign=bottom align=middle colSpan=5 height=160>
<DIV style="MARGIN-BOTTOM: 0px"><IMG src="2818 -- 密码.files/logopku.gif"
border=0> <IMG src="2818 -- 密码.files/logo4.gif" border=0></DIV></TD></TR>
<TR vAlign=top align=middle bgColor=#6589d1>
<TH class=h>Online Judge</TH>
<TH class=h>Problem Set</TH>
<TH class=h>Authors</TH>
<TH class=h>Online Contests</TH>
<TH class=h>User</TH></TR>
<TR vAlign=top align=middle bgColor=#f1f1fd>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><A
href="http://poj.grids.cn/bbs">Web Board</A><BR><A
href="http://poj.grids.cn/">Home Page</A><BR><A
href="http://poj.grids.cn/faq.htm"
target=_blank>F.A.Qs</A><BR>Announcement</TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=gotoproblem method=get><A
href="http://poj.grids.cn/problemlist">Problems</A><BR><A
href="http://poj.grids.cn/submit">Submit Problem</A><BR><A
href="http://poj.grids.cn/status">Online Status</A><BR><FONT
color=blue>Prob.ID:</FONT><INPUT size=6 name=pid><INPUT type=submit value=Go name=pb1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=searchuser method=get><A
href="http://poj.grids.cn/register">Register</A><BR><A
href="http://poj.grids.cn/modifyuser">Update your info</A><BR><A
href="http://poj.grids.cn/userlist">Authors ranklist</A><BR><INPUT size=10
name=key><INPUT type=submit value=Search name=B1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><FONT
color=#1a5cc8>Current Contest</FONT><BR><A
href="http://poj.grids.cn/pastcontests">Past Contests</A><BR><A
href="http://poj.grids.cn/contests">Scheduled Contests</A><BR><A
href="http://poj.grids.cn/awardcontest_announce.htm" target=_blank><FONT
color=red>Award Contest</FONT></A></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"
align=left>
<FORM action=login method=post>
<TABLE>
<TBODY>
<TR>
<TD>User ID:</TD>
<TD><INPUT size=10 name=user_id1></TD></TR>
<TR>
<TD>Password:</TD>
<TD><INPUT type=password size=10 name=password1></TD></TR></TBODY></TABLE><INPUT type=submit value=login name=B1> <A
href="http://poj.grids.cn/register" target=_parent>Register</A><INPUT
type=hidden value=/problem?id=2818 name=url></FORM></TD></TR></TBODY></TABLE>
<TABLE width="100%" background="2818 -- 密码.files/table_back.jpg" border=0>
<TBODY>
<TR>
<TD>
<P align=center><FONT color=blue size=5>密码</FONT> <BR>Time
Limit:1000MS Memory Limit:65536K<BR>Total Submit:6259 Accepted:1276
</P>
<P><FONT color=blue size=5>Description</FONT><BR><FONT
face="Times New Roman" size=3>Bob 和 Alice
开始使用一种全新的编码系统。它是一种基于一组私有钥匙的。他们选择了n个不同的数a1 , . . .,an, 它们都大于0小于等于n。
机密过程如下:待加密的信息放置在这组加密钥匙下,信息中的字符和密钥中的数字一一对应起来。信息中位于i位置的字母将被写到加密信息的第ai个位置, ai
是位于i位置的密钥。加密信息如此反复加密,一共加密 k 次。 <BR><BR>信息长度小于等于n。如果信息比 n 短,
后面的位置用空格填补直到信息长度为n。 <BR><BR>请你帮助 Alice 和 Bob 写一个程序,读入密钥,然后读入加密次数 k
和要加密的信息,按加密规则将信息加密。 <BR><BR><BR><BR></FONT></P>
<P><FONT color=blue size=5>Input</FONT><BR><FONT face="Times New Roman"
size=3>输入包括几块。每块第一行有一个数字n, 0 < n <= 200.
接下来的行包含n个不同的数字。数字都是大于0小于等于n的。下面每行包含一个k和一个信息字符串,它们之间用空格格开。每行以换行符结束,换行符不是要加密的信息。每个块的最后一行只有一个0。
最后一个块后有一行,该行只有一个0。 <BR></FONT></P>
<P><FONT color=blue size=5>Output</FONT><BR><FONT face="Times New Roman"
size=3>输出有多个块,每个块对应一个输入块。每个块包含输入中的信息经过加密后的字符串,顺序与输入顺序相同。所有加密后的字符串的长度都是 n。
每一个块后有一个空行。 <BR></FONT></P>
<P><FONT color=blue size=5>Sample Input</FONT><BR><FONT
face="Times New Roman" size=3><PRE>10
4 5 3 7 2 8 1 6 10 9
1 Hello Bob
1995 CERC
0
0
</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Sample Output</FONT><BR><FONT
face="Times New Roman" size=3><PRE>BolHeol b
C RCE
</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Source</FONT><BR><FONT face="Times New Roman"
size=3><A
href="http://poj.grids.cn/searchproblem?field=source&key=1026">1026</A></FONT></P></TD></TR></TBODY></TABLE><FONT
color=#333399 size=3>
<P align=center>[<A
href="http://poj.grids.cn/submit?problem_id=2818">Submit</A>] [<A
href="javascript:history.go(-1)">Go Back</A>] [<A
href="http://poj.grids.cn/problemstatus?problem_id=2818">Status</A>]
[<A href="http://poj.grids.cn/bbs?problem_id=2818">Discuss</A>] </FONT></P>
<P><IMG height=30 src="2818 -- 密码.files/home.gif" width=40 border=0><FONT
size=3><A href="http://poj.grids.cn/">Home Page</A> </FONT> <IMG
height=30 src="2818 -- 密码.files/goback.gif" width=40 border=0><FONT size=3><A
href="javascript:history.go(-1)">Go Back</A> <IMG height=30
src="2818 -- 密码.files/top.gif" width=40 border=0><A
href="http://poj.grids.cn/problem?id=2818#top">To top</A></FONT><BR>
<HR>
<P style="FONT-FAMILY: Arial," align=center sans-serif Helvetica,>All Rights
Reserved 2003-2006 Ying Fuchen,Xu Pengcheng,Xie Di<BR>Any problem, Please <A
href="mailto:xiedipoj@yahoo.com">Contact Administrator</A></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -