题目名称 | 1262. [NOIP 2012]Vigenère密码 |
---|---|
输入输出 | vigenere.in/out |
难度等级 | ★ |
时间限制 | 1000 ms (1 s) |
内存限制 | 128 MiB |
测试数据 | 10 |
题目来源 | 王者自由 于2012-11-10加入 |
开放分组 | 全部用户 |
提交状态 | |
分类标签 | |
分享题解 |
通过:419, 提交:775, 通过率:54.06% | ||||
hjr1995 | 100 | 0.000 s | 0.00 MiB | Pascal |
TerryLam | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
XUEYAN | 100 | 0.000 s | 0.00 MiB | Pascal |
本题关联比赛 | |||
NOIP 2012 Day1 | |||
20121121 | |||
2012Day1 | |||
NOIP2015普及组练习 |
关于 Vigenère密码 的近10条评论(全部评论) | ||||
---|---|---|---|---|
回复 @ItsOreó :
23333
Theresis
2020-09-07 21:27
23楼
| ||||
reØreOré
2020-09-07 21:25
22楼
| ||||
不会吧不会吧真有人这道题都要问别人
增强型图元文件
2020-09-07 21:21
21楼
| ||||
废了。。。水题调半小时
| ||||
回复 @邹 :
你为什什么题写完都要发言
渴望诗的小男孩
2016-11-16 18:44
19楼
| ||||
自己以前太弱了...一天没过的题这次半个小时水过
ps 刚发完这个评论oj就炸了...这个问题? | ||||
('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'),
('B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A'), ('C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B'), ('D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C'), ('E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D'), ('F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E'), ('G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F'), ('H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G'), ('I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H'), ('J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I'), ('K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J'), ('L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K'), ('M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L'), ('N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M'), ('O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N'), ('P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O'), ('Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P'), ('R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q'), ('S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R'), ('T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S'), ('U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T'), ('V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U'), ('W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V'), ('X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W'), ('Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X'), ('Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y'); | ||||
回复 @铁策 :
需要用加文件操作的.......
TARDIS
2016-10-16 19:54
16楼
| ||||
这道题,用密钥算个offset然后把加密后的减去offset,如果比A或a小就加上26。
十分弱智的一道题,打表都不用。 | ||||
第六个点 nimahannihuijiachifanaaaaaaaaaaaaaa 什么鬼!!!!wa50刷新一下就变成AC100了!!!!!!!
|
16 世纪法国外交家Blaise de Vigenère设计了一种多表密码加密算法——Vigenère密码。Vigenère 密码的加密解密算法简单易用,且破译难度比较高,曾在美国南北战争中为南军所广泛使用。
在密码学中,我们称需要加密的信息为明文,用 M 表示;称加密后的信息为密文,用C 表示;而密钥是一种参数,是将明文转换为密文或将密文转换为明文的算法中输入的数据,记为k。 在Vigenère密码中, 密钥k是一个字母串, k=k1k2…kn。当明文M=m1m2…mn时,得到的密文C=c1c2…cn,其中ci=mi®ki,运算®的规则如下表所示:
Vigenère加密在操作时需要注意:
1. ®运算忽略参与运算的字母的大小写,并保持字母在明文 M中的大小写形式;
2. 当明文M的长度大于密钥k的长度时,将密钥k 重复使用。
例如,明文M=Helloworld,密钥k=abc 时,密文C=Hfnlpyosnd。
明文 |
H |
e |
l |
l |
o |
w |
o |
r |
l |
d |
密钥 |
a |
b |
c |
a |
b |
c |
a |
b |
c |
a |
密文 |
H |
f |
n |
l |
p |
y |
o |
s |
n |
d |
输入共2行。
第一行为一个字符串,表示密钥k,长度不超过100,其中仅包含大小写字母。第二为一个字符串,表示经加密后的密文,长度不超过1000,其中仅包含大小写字母。
输出共1行,一个字符串,表示输入密钥和密文所对应的明文。
CompleteVictory Yvqgpxaimmklongnzfwpvxmniytm
Wherethereisawillthereisaway
对于 100%的数据,输入的密钥的长度不超过 100,输入的密文的长度不超过 1000,且都仅包含英文字母。