摘要: 1.hdu--4513 吉哥系列故事——完美队形II http://acm.hdu.edu.cn/showproblem.php?pid=4513 题意:中文题不解释 思路:数字型的manachar算法。将模板中的比较字符改为比较数字就行了。 AC代码: 1 #include <iostream> 阅读全文
posted @ 2016-12-01 21:05 Wally的博客 阅读(485) 评论(0) 推荐(0) 编辑
摘要: Description 给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Description 给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一 阅读全文
posted @ 2016-12-01 20:16 Wally的博客 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 关于ac自动机模板是非常重要的,在上一篇文章中已经给出了非常好用的数组类型的模板。下面的题目都是在模板之上进行略微修改就能ac的简单题 1.hdu--3065 病毒侵袭持续中 http://acm.hdu.edu.cn/showproblem.php?pid=3065 题意:统计子串在主串中出现的次 阅读全文
posted @ 2016-11-22 23:38 Wally的博客 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Description 当太阳的光辉逐渐被月亮遮蔽,世界失去了光明,大地迎来最黑暗的时刻。。。。在这样的时刻,人们却异常兴奋――我们能在有生之年看到500年一遇的世界奇观,那是多么幸福的事儿啊~~ 但网路上总有那么些网站,开始借着民众的好奇心,打着介绍日食的旗号,大肆传播病毒。小t不幸成为受害者之一 阅读全文
posted @ 2016-11-22 23:08 Wally的博客 阅读(255) 评论(0) 推荐(0) 编辑
摘要: Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重 阅读全文
posted @ 2016-11-12 20:42 Wally的博客 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally s 阅读全文
posted @ 2016-11-11 21:21 Wally的博客 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superi 阅读全文
posted @ 2016-11-09 21:16 Wally的博客 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Description Given n integers. You have two operations: U A B: replace the Ath number by B. (index counting from 0) Q A B: output the length of the lon 阅读全文
posted @ 2016-11-07 21:30 Wally的博客 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Description Corrupt governors always find ways to get dirty money. Paint something, then sell the worthless painting at a high price to someone who wa 阅读全文
posted @ 2016-11-05 15:50 Wally的博客 阅读(112) 评论(0) 推荐(0) 编辑
摘要: Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the 阅读全文
posted @ 2016-11-02 14:09 Wally的博客 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecut 阅读全文
posted @ 2016-11-02 13:51 Wally的博客 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工 阅读全文
posted @ 2016-11-02 13:30 Wally的博客 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral poste 阅读全文
posted @ 2016-10-30 20:45 Wally的博客 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Description An array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very 阅读全文
posted @ 2016-10-30 20:14 Wally的博客 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the leve 阅读全文
posted @ 2016-10-30 17:13 Wally的博客 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Description In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping 阅读全文
posted @ 2016-10-22 21:57 Wally的博客 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Description For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a g 阅读全文
posted @ 2016-10-22 21:41 Wally的博客 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://codeforces.com/contest/732/problem/D 题意:给出n,m然后给出n天的计划(第i天考试考试科目)再给出m个数表示第i个的预习时间,问多少天能把所有的科目考完?? 思路:用二分法找出天数k然后从第k天往第1天推,如果满足当前所需天数小于k则把 阅读全文
posted @ 2016-10-21 13:12 Wally的博客 阅读(142) 评论(0) 推荐(0) 编辑
摘要: Description In mathematics, the four color theorem, or the four color map theorem, states that, given any separation of a plane into contiguous region 阅读全文
posted @ 2016-10-19 16:52 Wally的博客 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Description Three Kingdoms is a funny game. Often Liu Bei is weak and has to run away,so in the game Liu Bei has a skill called "Dunzou". This time yo 阅读全文
posted @ 2016-10-14 20:48 Wally的博客 阅读(171) 评论(0) 推荐(0) 编辑
摘要: Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this 阅读全文
posted @ 2016-10-13 13:22 Wally的博客 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=1197 注意事项: 1.初始数组长度为零 2.同样路径可能花费不同的时间 3.运用变形的Dijkstra算法 代码思路: 先初始化二维数组e和cot再输入数据并更 阅读全文
posted @ 2016-09-09 18:47 Wally的博客 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1010 我认为的剪枝就是在本来的代码中加入一些附加条件使之不去进行多余的计算,防止超时 奇偶剪枝的知识链接 AC代码: 1 #include <iostream> 2 #include <cstdio> 阅读全文
posted @ 2016-08-12 16:09 Wally的博客 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://lightoj.com/volume_showproblem.php?problem=1337 这个题最重要的就是记忆化搜索,根据这个题我所知道的记忆化搜索就是:当出现某一测试数据时把与其有关的数据都搜索出来,以备后用。 AC代码: 1 #include <iostream 阅读全文
posted @ 2016-08-12 16:00 Wally的博客 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://poj.org/problem?id=2488 注意两点: 1.本题要求按照字典序最小输出所以a[8]={-1, 1, -2, 2, -2, 2, -1, 1},b[8]={-2, -2, -1, -1, 1, 1, 2, 2} 2.由于 1 <= p * q <= 26所 阅读全文
posted @ 2016-08-12 15:52 Wally的博客 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://lightoj.com/volume_showproblem.php?problem=1066 题目很容易,广搜和深搜应该都行,我个人认为要注意的是‘A’-->‘ . ’ AC代码: 1 #include <iostream> 2 #include<cstdio> 3 #i 阅读全文
posted @ 2016-08-12 15:43 Wally的博客 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3466 题目很容易理解,但是如何将其转换为01背包是个问题。 对物品按 qi-pi 的值从小到大排序,因为这样可以保证每次更新的状态值从小到大递增,前面更新过的状态不会影响后面更新的状态。 题目代码: 阅读全文
posted @ 2016-08-09 21:28 Wally的博客 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2639 求第k优解的关键代码: 用两个数组记录两种状态(选择或不选择),并且只要记录前k次。在这两个数组中都是前k次可能的最优解。所以我们只要把这两个数组做比较,一直排到k就行了 题目代码: 1 #in 阅读全文
posted @ 2016-08-09 20:48 Wally的博客 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 第一个深搜的问题,虽然很简单,但是很高兴,加油!!! 题目链接: http://poj.org/problem?id=2386 题目交了好几次,一直RE,又重新写了一遍总算是A了 最初RE是由于是s[x][y]='#'放到了dfs的后面,以后要把最初的改变放在前面 RE代码,引以为戒: 1 #inc 阅读全文
posted @ 2016-08-09 19:42 Wally的博客 阅读(133) 评论(0) 推荐(0) 编辑
摘要: input 输入n,m,k分别代表城市个数,路的条数,和要求城市 然后输入m跳路,ai,bi,ci表示城市ai到城市bi的距离是ci output 求每个城市到城市k的距离 input 1 #include <iostream> 2 #include <cstdio> 3 #define MAX 1 阅读全文
posted @ 2016-08-03 16:23 Wally的博客 阅读(188) 评论(0) 推荐(0) 编辑