题意: 给定一对用凯撒密码加密的明文和密文,再给你一个密文,让你解密出明文,保证有唯一解. 题解: 对凯撒密码的已知明文攻击,签到题. #include<iostream> using namespace std; ],c2[],c3[]; int t; int main(){ int __; scanf("%d",&__); ;_<=__;_++){ int n,m; scanf("%d %d",&n,&m); scanf…
In cryptography, a Caesar cipher, also known as the shift cipher, is one of the most straightforward and most widely known encryption techniques.It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fi…
https://codeforc.es/gym/102222/my 好像在哪里见过这个东西?字符的左右移还是小心,注意在mod26范围内. #include<bits/stdc++.h> using namespace std; typedef long long ll; inline int read() { int x=0; int f=0; char c; do { c=getchar(); if(c=='-') f=1; } while(c<'0'||c>'9'); do…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Polycarp loves ciphers. He has invented his own cipher called Right-Left. Right-Left cipher is used for strings. To encrypt the string s=s1s2…
题目链接:http://codeforces.com/contest/118/problem/D 有n个步兵和m个骑兵要排成一排,其中连续的步兵不能超过k1个,连续的骑兵不能超过k2个. dp[i][j][x][y]表示表示用i个步兵和j个骑兵,末尾有连续的x个步兵,或者有连续的y个骑兵. 所以x > 0 && y > 0的情况不存在.三个for就好了. #include <bits/stdc++.h> using namespace std; typedef lo…
codeforces 897A Scarborough Fair 题目链接: http://codeforces.com/problemset/problem/897/A 思路: 暴力大法好 代码: #include <iostream> #include <stdio.h> #include <string.h> using namespace std; typedef long long ll; int n,m; string s; int main() { ios…
题目链接:https://codeforces.com/contest/1090/problem/M There are n houses along the road where Anya lives, each one is painted in one of k possible colors. Anya likes walking along this road, but she doesn't like when two adjacent houses at the road have…
#include <iostream> using namespace std; int main() {int k,i; char s[5];  cin>>k;  for(;k>=26;)k%=26;  for(i=0;i<5;i++)  { cin>>s[i];      if(('a'<=s[i]&&s[i]<='z')||('A'<=s[i]&&s[i]<='Z'))    {s[i]+=k;…
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <utility> #include <vector> #include <map> #include <queue> #include <stack> #include <…
[链接] 我是链接,点我呀:) [题意] 序列中不能连续出现k1个以上的1以及不能连续出现k2个以上的2,然后一共有n1个1以及n2和2,要求这n1+n2个数字都出现. 问序列有多少种可能. [题解] 这题其实可以转化一下思路. 看成是两个人在轮流给空串后面添加1,2字符串. 第一个人添的是重复的"1",第二个人是重复的"2" 然后第一个人添加的"1"的个数不能超过k1,第二个人添加的"2"("1")的个数…