P1079 Vigenère 密码
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int main() {
freopen("input.in", "r", stdin);
char mi[maxn], key[105];
scanf("%s%s", key, mi);
char ming[maxn];
for(int i = 0; i < strlen(mi); i++) {
int x = tolower(key[i%strlen(key)]) - 'a';
int y;
if(mi[i] >= 'a' && mi[i] <= 'z') {
y = mi[i] - 'a' - x;
if(y < 0) y += 26;
y += 'a';
}
if(mi[i] >= 'A' && mi[i] <= 'Z') {
y = mi[i] - 'A' - x;
if(y < 0) y += 26;
y += 'A';
}
ming[i] = y;
}
for(int i = 0; i < strlen(mi); i++) cout << ming[i];
return 0;
}
开始wa,以后要注意输出字符串要注意
P1079 Vigenère 密码的更多相关文章
- [NOIP2012] 提高组 洛谷P1079 Vigenère 密码
题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密 码.Vigenère 密码的加密解密算法简单易用,且破译难度比较高,曾在美国南 ...
- 洛谷 P1079 Vigenère 密码
题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密 码.Vigenère 密码的加密解密算法简单易用,且破译难度比较高,曾在美国南 ...
- 洛谷P1079 Vigenère 密码
题目链接:https://www.luogu.org/problemnew/show/P1079
- 2012 noip提高 Vigenère 密码
P1079 Vigenère 密码 题目描述 16 世纪法国外交家 Blaise de VigenèreBlaisedeVigene`re 设计了一种多表密码加密算法―― VigenèreVigene ...
- Vigenère密码 2012年NOIP全国联赛提高组(字符串模拟)
P1079 Vigenère 密码 题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密 码.Vigenère 密码的加密解密算法简 ...
- NOIP 2012 Vigenère 密码
洛谷 P1079 Vigenère 密码 https://www.luogu.org/problemnew/show/P1079 JDOJ 1779: [NOIP2012]Vigenèr密码 D1 T ...
- luoguP1079 Vigenère 密码 题解(NOIP2012)
P1079 Vigenère 密码 题目 #include<iostream> #include<cstdlib> #include<cstdio> #includ ...
- Vigenère密码
来源 NOIP2012复赛 提高组 第一题 描述 16世纪法国外交家Blaise de Vigenère设计了一种多表密码加密算法--Vigenère密码.Vigenère密码的加密解密算法简单易用 ...
- NOIp 2012 #1 Vigenère 密码 Label:模拟
题目描述 16 世纪法国外交家 Blaise de Vigenère 设计了一种多表密码加密算法――Vigenère 密 码.Vigenère 密码的加密解密算法简单易用,且破译难度比较高,曾在美国南 ...
随机推荐
- OpenCV(5) 对比度和亮度
公式: 两个参数 \alpha > 0 和 \beta 一般称作 增益 和 偏置 参数.我们往往用这两个参数来分别控制 对比度 和 亮度 . #include "stdafx. ...
- keytool创建Keystore和Trustsotre文件
一.生成一个含有一个私钥的keystore文件 user@ae01:~$ keytool -genkey -keystore keystore -alias jetty-azkaban -keyalg ...
- (转)Storm UI 解释
Storm UI link:http://lbxc.iteye.com/category/221265 本文主要解释下storm ui上各项属性的含义. 1. mainpage 首页主要分为3块: a ...
- Ubuntu下SVN配置
今天上午写了一个脚本,然后想起来现在写的R脚本,常常在分析过程中就直接改掉了.隐隐还是觉得存在隐患,想着svn部署应该不会太难,于是就直接动手干了. 弄了一上午的时间,感觉还是花了点时间. 这里有篇b ...
- Zepto Code Rush 2014 A. Feed with Candy
此题用贪心求解, 首先将caramel drop类别的糖果按照高度从小到大排序,如果高度相同,按照重量从小到大排序 将fruit drop类别的糖果按照高度从小到大排序,如果高度相同,按照重量从小到大 ...
- 关于vim插件
本人比较喜欢amix它集成了很多插件. 1.mru.vim:用于打开最近使用过的文件 使用命令: :MRU 打开最近的文件列表 上下箭头可以移动关标 :o 在新窗口中打开文件 2.NERD T ...
- codeforces round #234B(DIV2) A Inna and Choose Options
#include <iostream> #include <string> #include <vector> using namespace std; ; ,,, ...
- ACM: HDU 2563 统计问题-DFS+打表
HDU 2563 统计问题 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u HDU 2 ...
- linq中join的用法
join方法 public static IEnumerable<TResult> Join<TOuter, TInner, TKey, TResult>( this IEnu ...
- Selenium_获取相对坐标
<html> <head> <title>位置</title> <style> .test { background: url(" ...