Codeforces gym102222 C. Caesar Cipher 签到
题意:
给定一对用凯撒密码加密的明文和密文,再给你一个密文,让你解密出明文,保证有唯一解。
题解:
对凯撒密码的已知明文攻击,签到题。
#include<iostream>
using namespace std;
char c1[],c2[],c3[];
int t;
int main(){
int __;
scanf("%d",&__);
for(int _=;_<=__;_++){
int n,m;
scanf("%d %d",&n,&m);
scanf("%s %s",c1,c2);
t=(c1[]-c2[]+)%;
scanf("%s",c3);
printf("Case #%d: ",_);
for(int i=;i<m;i++){
printf("%c",(c3[i]-'A'+t)%+'A');
}
printf("\n");
}
return ;
}
Codeforces gym102222 C. Caesar Cipher 签到的更多相关文章
- 2018 ACM-ICPC 宁夏 C.Caesar Cipher(模拟)
In cryptography, a Caesar cipher, also known as the shift cipher, is one of the most straightforward ...
- Codeforces - 102222C - Caesar Cipher
https://codeforc.es/gym/102222/my 好像在哪里见过这个东西?字符的左右移还是小心,注意在mod26范围内. #include<bits/stdc++.h> ...
- Codeforces Round #528-A. Right-Left Cipher(字符串模拟)
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- Codeforces 118 D. Caesar's Legions (dp)
题目链接:http://codeforces.com/contest/118/problem/D 有n个步兵和m个骑兵要排成一排,其中连续的步兵不能超过k1个,连续的骑兵不能超过k2个. dp[i][ ...
- codeforces 897A Scarborough Fair 暴力签到
codeforces 897A Scarborough Fair 题目链接: http://codeforces.com/problemset/problem/897/A 思路: 暴力大法好 代码: ...
- Codeforces 1090M - The Pleasant Walk - [签到水题][2018-2019 Russia Open High School Programming Contest Problem M]
题目链接:https://codeforces.com/contest/1090/problem/M There are n houses along the road where Anya live ...
- Caesar cipher
#include <iostream> using namespace std; int main() {int k,i; char s[5]; cin>>k; for(; ...
- The 2018 ACM-ICPC Chinese Collegiate Programming Contest Caesar Cipher
#include <iostream> #include <cstdio> #include <cstring> #include <string> # ...
- 【Codeforces 118B】Caesar's Legions
[链接] 我是链接,点我呀:) [题意] 序列中不能连续出现k1个以上的1以及不能连续出现k2个以上的2,然后一共有n1个1以及n2和2,要求这n1+n2个数字都出现. 问序列有多少种可能. [题解] ...
随机推荐
- Android代码学习--点击事件的几种写法
由来:常规的写法参见<写一个apk>,每次点击按钮,按钮先查找文本框等元素,然后再操作,其实查找操作是很费时的操作,因此将该定义放到Activity的onCreate中:Oncreate只 ...
- JS-JSDoc
http://usejsdoc.org/ 生成 JSDoc 格式的注释: sublime:安装 DocBlockr VSCode:自带 JSDoc 插件
- python json格式参数遍历所有key、value 及替换key对于的value
1.对于接口自动化测试,一般接口以json形式发送返回,往往我们就需要遍历json文件中所有key,value以及修改替换key对于的value. 例如json发送/接收的文件: SendRegist ...
- python3迷宫,多线程版
上图: 直接上代码 #!/usr/bin/python3 #coding=GB2312 import tkinter as tk import threading import time import ...
- OAccflow集成sql
SELECT * FROM PORT_EMP WHERE NO='18336309966'SELECT * FROM PORT_DEPT WHERE no='42DBAF50712C4046B09BC ...
- ROW_NUMBER() over(order by ID desc ) as RowNumber 返回类型问题
因为ID是int类型,所以ROW_NUMBER() over(order by ID desc ) as RowNumber 想当然的认为是Int类型 实际ROW_NUMBER() over(orde ...
- 第一周复习二 (CSS样式表及其属性)
样式表三种写法 1内联写法:style直接写在标签内.个人感觉多用于个别标签,一般情况优先级较高 style="font-size:16px;" 2内嵌写法:写在<head& ...
- Python django tests
单元测试函数必须以test_开头,否则无法被识别
- shell编程:命令替换的运用
命令替换,有两种方式 方式一:`command` 方式二:$(command) user.sh 查找系统中所有的用户,并且输出 #!/bin/bash nginx=`netstat -tnlp | | ...
- Python之小测试:用正则表达式写一个小爬虫用于保存贴吧里的所有图片
很简单的两步: 1.获取网页源代码 2.利用正则表达式提取出图片地址 3.下载 #!/usr/bin/python #coding=utf8 import re # 正则表达式 import urll ...