![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
Joyyiwei
这个作者很懒,什么都没留下…
展开
-
uva 401
题意:回文,镜像的判断,写成函数,便于后面的判断nclude #include #include using namespace std;const int MAXN = 1024 ;char const *ch = "AEHIJLMOSTUVWXYZ12358"; char const *re = "A3HILJMO2TUVWXY51SEZ8"; int is原创 2013-08-02 16:33:29 · 846 阅读 · 0 评论 -
ZOJ - 3818 Pretty Poem
DescriptionPoetry is a form of literature that uses aesthetic and rhythmic qualities of language. There are many famous poets in the contemporary era. It is said that a few ACM-ICPC contestants ca原创 2014-09-07 21:36:29 · 1323 阅读 · 0 评论 -
UVA - 10815 Andy's First Dictionary
DescriptionProblem B: Andy's First DictionaryTime limit: 3 secondsAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for原创 2014-08-25 16:17:02 · 771 阅读 · 0 评论 -
UVA - 644 Immediate Decodability
Description Immediate Decodability An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for another symbol.原创 2014-08-26 17:03:51 · 667 阅读 · 0 评论 -
UVA - 10878 Decode the tape
Description "Machines take me by surprise with great frequency."Alan TuringYour boss has just unearthed a roll of old computer tapes. The tapes have holes in them and might conta原创 2014-08-26 17:20:50 · 721 阅读 · 0 评论 -
UVA - 10010 Where's Waldorf?
Description Where's Waldorf? Given a m by n grid of letters, ( ), and a list of words, find the location in the grid at which the word can be found. A word matches a strai原创 2014-08-25 17:14:25 · 766 阅读 · 0 评论 -
CodeForces - 25E Test (KMP应用)
DescriptionSometimes it is hard to prepare tests for programming problems. Now Bob is preparing tests to new problem about strings — input data to his problem is one string. Bob has 3 wrong soluti原创 2014-08-06 14:17:49 · 1287 阅读 · 0 评论 -
UVA - 10298 Power Strings (KMP求字符串循环节)
DescriptionProblem D: Power StringsGiven two strings a and b we define a*b to be their concatenation. For example, ifa = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation a原创 2014-07-19 16:23:09 · 1220 阅读 · 0 评论 -
HDU - 1711 Number Sequence (KMP模板)
题意:找最早匹配的位置思路:KMP的模板题#include #include #include #include using namespace std;const int MAXN = 1000010;int a[MAXN],b[MAXN],next[MAXN];int n,m;void getnext(int b[]){ int i = 0,j = -1,len原创 2014-03-16 15:10:55 · 761 阅读 · 0 评论 -
UVA - 10029 Edit Step Ladders (二分+hash)
DescriptionProblem C: Edit Step LaddersAn edit step is a transformation from one word x to another wordy such that x and y are words in the dictionary, and x can be transformed to y by原创 2014-08-30 15:14:52 · 1020 阅读 · 0 评论 -
HDU - 5007 Post Robot
Problem DescriptionDT is a big fan of digital products. He writes posts about technological products almost everyday in his blog.But there is such few comments of his posts that he feels depress原创 2014-09-14 23:01:25 · 1556 阅读 · 1 评论 -
Codeforces Round #265 (Div. 2) C. No to Palindromes!
Paul hates palindromes. He assumes that strings is tolerable if each its character is one of the firstp letters of the English alphabet and s doesn't contain any palindrome contiguous substring原创 2014-09-17 17:04:43 · 1314 阅读 · 1 评论 -
HDU - 4550 卡片游戏
Description 小明最近宅在家里无聊,于是他发明了一种有趣的游戏,游戏道具是N张叠在一起的卡片,每张卡片上都有一个数字,数字的范围是0~9,游戏规则如下: 首先取最上方的卡片放到桌子上,然后每次取最上方的卡片,放到桌子上已有卡片序列的最右边或者最左边。当N张卡片全部都放到桌子上后,桌子上的N张卡片构成了一个数。这个数不能有前导0,也就是说最左边的卡片上的数字不能是0。游戏的原创 2014-07-04 17:07:42 · 1109 阅读 · 0 评论 -
POJ - 1731 Orders
题意:排序后字符串全排列思路:好久没水一题了#include #include #include #include using namespace std;const int MAXN = 220;char str[MAXN];int main() { while (scanf("%s", str) != EOF) { int n = strlen(str);原创 2014-07-01 09:30:21 · 838 阅读 · 0 评论 -
HDU - 4054 Hexadecimal View (2011 Asia Dalian Regional Contest)
题意:按要求输出,第一列是表示第几行,每行只能有16个字节的字母,第二列是16进制的ASCII码,第三列大小写转换思路:纯模拟,注意字母的十六进制是2位#include #include #include #include using namespace std;const int MAXN = 5000;char str[MAXN];int main() { whil原创 2014-07-01 11:29:10 · 1512 阅读 · 0 评论 -
uva 409
题意:找到关键词最多的借口输出#include #include #include using namespace std;char key[25][25];char exe[75];char excuses[25][75];int cnt[100];int k,e;int find(char *tmp) //找出key最多的借口,然后输出{ int sum原创 2013-08-02 16:30:50 · 791 阅读 · 0 评论 -
uva 10115
题意 : 就是字符串的替换咯,用strstr()处理,不难#include #include #include using namespace std;char a[220][220];char b[220][220];char c[220];int main(){ int t; while(cin>>t && t) { getchar原创 2013-08-02 16:29:03 · 708 阅读 · 0 评论 -
uva 537
思路:遇到等号,将数据存在数组里,直接以这个字符作为数组下标,最后判断就行了#include #include double sum(char *str) { double s=0; int leap,i,n; n=strlen(str); leap=1; for(i=0;i<n;i++) { if(原创 2013-08-02 16:26:46 · 818 阅读 · 0 评论 -
hdu 2577
题意:问你打印这串字符串的最小步数,我们可以记录当时的Caps Lock键是否是打开,然后就是一步步的判断了#include #include #include using namespace std;int main(){ int t; scanf("%d",&t); while (t--) { int on = 0;原创 2013-08-14 20:40:46 · 644 阅读 · 0 评论 -
UVA - 11732 strcmp() Anyone?
题意:题目给出了标准strcmp()函数的代码,给你n个单词(n 思路:字符串S1,S2比较分两种情况:S1和S2有相同的前缀S,那么ans = len(S)*2+1;S1和S2完全相同的话:ans = (len(S)+1) * 2,等于算上了‘\0’然后按照Trie的构造方法:采用了左儿子右兄弟的方法,但是看到网上的都是提交错误,就先存着#include #include #i原创 2014-02-20 22:54:19 · 1150 阅读 · 0 评论 -
UVA - 11488 Hyper Prefix Sets
题意:给定一个字符串集合S,定义P(S)为所有字符串的公共前缀长度与S中字符串个数的乘积,从中选出一个集合S,使得P(S)最大思路:也是一道Trie树的应用,在每个节点在加上一个当前到此节点的字符串个数就行了#include #include #include #include using namespace std;const int MAXN = 10000010;str原创 2014-02-25 21:29:46 · 950 阅读 · 0 评论 -
UVALive - 5913 Dictionary Size
题意:求有前后缀组成的不同的字符串思路:先用Trie树来统计前后缀不同的字符串,然后就是去重例如:前后缀分别是x1x1x1x1a,ax2x2x2x2x2的话,那么可能重复的字符串x1x1x1x1ax2x2x2x2x2,统计前后缀分别以a结尾的个数,然后减去#include #include #include #include using namespace std;con原创 2014-02-26 19:13:17 · 1226 阅读 · 0 评论 -
UVALive - 3942 Remember the Word (Trie)
题意:给你一个有S个不同单词组成的字典和一个长字符串,把这个字符串分解成若干个单词的连接,有多少种方法思路:转化为Trie树的形式储存,用d(i)表示字符从i开始的字符串的分解方案,每次搜索到一个单词末的时候就可以累加了#include #include #include #include const int maxnode = 300001;const int sigma_si原创 2014-02-20 12:54:26 · 988 阅读 · 0 评论 -
POJ - 2513 Colored Sticks
题意:有一些木棍,木棍的两边各有一种颜色,如果两根木棍的一边颜色相同的话,那么就可以连在一起,问能不能完全连成一根思路:不在是简单的欧拉路,如果能将颜色表达成一个数字的话就能转化为欧拉路了,用Trie树来优化,再用并查集判断是否为欧拉路#include #include #include #include #include using namespace std;const原创 2014-03-05 22:23:48 · 968 阅读 · 0 评论 -
HDU - 1251 统计难题
题意:判断前缀思路:字典树的应用#include #include #include #include using namespace std;struct node{ int count; node *trie[26];}*a;void init(){ a = new node; for (int i = 0; i < 26; i++) a->trie[i]原创 2014-03-07 21:38:59 · 804 阅读 · 0 评论 -
POJ - 1743 Musical Theme (后缀数组求不可重叠最长重复子串)
DescriptionA musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this原创 2014-09-25 20:55:54 · 1864 阅读 · 0 评论