HDU 4300 Contest 1】的更多相关文章

扩展KMP很容易就明白过来了. 注意的是,后面明文的长度要少于密文,而且当前K+Extend[k]>=L 输出时犯了很多次二,后来人注意吧. #include <cstdio> #include <cstring> #include <string.h> #include <iostream> using namespace std; char t[30]; char table[30]; char code[100005]; char chan[10…
HDU - 4300 题意:这个题目好难读懂,,先给你一个字母的转换表,然后给你一个字符串密文+明文,密文一定是全的,但明文不一定是全的,求最短的密文和解密后的明文: 题解:由于密文一定是全的,所以他的长度一定大于整个字符串的一半.将这一半先解密,然后和后缀对比一下,求最长的公共前缀.那么就转换为了拓展kmp问题. 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 const int maxn=100010; //字符串长度最大值 5 i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4300 Problem Description Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd. They had agreed that ea…
http://acm.hdu.edu.cn/showproblem.php?pid=4300 Clairewd’s message Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4411    Accepted Submission(s): 1676 Problem Description Clairewd is a member of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4300 题目大意:题目大意就是给以一段字符xxxxzzz前面x部分是密文z部分是明文,但是我们不知道是从哪里将密文和明文分开的, 密文是完整的,明文可能是不完整的,需要你补全,使得明文长度尽可能短. 解题思路: 因为密文至少占一半长度,所以从mid~len先假设为明文,然后将明文转成密文求出nxt[len](nxt[len]<=len-nxt[eln],不断递归nxt[len]直到满足条件)即为明文长…
Clairewd’s message 题意:先一个转换表S,表示第i个拉丁字母转换为s[i],即a -> s[1];(a为明文,s[i]为密文).之后给你一串长度为n<= 100000的前面为密文后面为明文的串:让你通过密码转换表S在这个串的后面添加字符,使得前面的密文翻译成明文之后与后面相对应,最后输出添加字符后的串(前面密文照常输出): Sample Input 2 abcdefghijklmnopqrstuvwxyz abcdab qwertyuiopasdfghjklzxcvbnm q…
Problem Description In the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems.  On Mars, there is programming contest, too. Each team c…
意甲冠军:N个人M通过主打歌有自己的期望,每个问题发送人玩.它不能超过随机播放的次数1,追求最大业绩预期 (1 ≤ N ≤ 10,1 ≤ M ≤ 1000). 主题链接:pid=5045" target="_blank">http://acm.hdu.edu.cn/showproblem.php?pid=5045 -->>设dp[i][j]表示已出战了前i - 1道题目,已出战的人的状态序列为j,如今要做第i道题目的最大期望.则最后要求的结果为max{dp[…
Contest Problem Description In the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming problems. On Mars, there is programming contest, too. Each…
题目链接:https://cn.vjudge.net/contest/276379#problem/J 感觉讲的很好的一篇博客:https://subetter.com/articles/extended-kmp-algorithm.html 题目大意:这是一个编译密码的题目,首先给你26个字母分别重新编码后的对应的字母,然后再给你一个字符串,字符串的前一部分是编译过后的,后一部分是编译之前的,但是后一部分可能会有损失,问你用尽量少的字符,将整个字符串补起来,也就是前面是暗文,后面是明文. 具体…