- 博客(98)
- 收藏
- 关注
转载 dp求最长回文字串leetcode#5
状态转移方程:p[i][i] = 1;p[i] = p[i+1] = 1(if s[i]=s[i+1])p[i][j] = 1(if p[i+1][j-1]&&s[i]=s[j])转载于:https://www.cnblogs.com/EdsonLin/p/5965289.html
2016-10-15 20:50:00
189
转载 zjgsu第五场解题报告
A.hdu1003Max Sumdp求最大序列和dp[i] = max(dp[i-1],0)+a[i] ps.dp[i]当前元素结尾的最大序列和mmax = max(mmax,dp[i])讲的不清楚,可以看看别人的思路http://alorry.blog.163.com/blog/static/6472570820123801223397/#in...
2016-08-03 20:32:00
398
转载 Project Euler 26-50
A.Reciprocal cycles求小数循环节的方法#include <iostream>#include <cstdio>#include <cstring>#include <string>using namespace std;const int MAXN = 1e4+100;int...
2016-07-29 02:25:00
202
转载 graph theory:
Floyd : City of Blinding Lights重点距离为0平时都不用floy,一到用时,竟然写不来。。。#include <cstdio>#include <iostream>#include <string>#include <cstring>#include <algorith...
2016-07-28 02:50:00
216
转载 codeforces#688B Lovely Palindromes
http://codeforces.com/problemset/problem/688/B5k人以上做出来的大水题,题目还是非常有爱的,找规律,发现2-digit有9个,4-digit有90个,然后就是900,9000的序列题目要求最k个序列是什么,比如980个,必然是是在3-gidit内(980<999)这个序列有一个规律,第(k)个回文长度必然是2*(k的位数),...
2016-07-25 18:58:00
194
转载 Project Euler 1-25
A. Multiples of 3 and 5大水题,计算出below n内是3,5倍数的总和数据较大,只能用求和公式#include <iostream>#include <cstdio>typedef long long ll;using namespace std;int main(){ int T;...
2016-07-25 01:02:00
149
转载 BestCoder Round #84
A.贪心B.b题我昨晚看两个队友都没写出来,早上看觉得挺简单的,天真以为是要以ai结尾的连续的,wa1...然后知道是可以不连续的,做着做着忘了是要以ai结尾的,以为是前面的子序列最长就可以了,wa4...其实如果了解O(nlogn)的算法就可以很快想出来了,亏我还是写过模板的人,各种wa我也是醉了,每次只要在找到当前数字在LIS数组上的位置就可以了题目还是挺好的,我发现题目...
2016-07-24 14:51:00
111
转载 codeforces#689BMike and Shortcuts
最近忙于写题和被虐,还有懒,好久没有更新博客了,昨天被虐了一整天,整个人都是迷茫状态,好好补cf吧发现挺有意思的这题就是cur点可以到cur-1,cur+1,a[cur]三个位置,求最短路径问题题目数据量较大,当时没想到可以用bfs,也是好久没有用纯搜索了,时间复杂度不会算呀,我以为会超的orz所以妥妥去想dp,然后没用想到题目可以往回走,妥妥wa,今天下午也是这样,wa...
2016-07-24 01:55:00
122
转载 POJ2985 并查集+线段树 求第k大的数
其实这题之前做过,线段树一直不熟,所以也一直没有搞懂本题的关键是线段树原始区间代表的是每一种容器(size不同)的数量比如 刚开始都是互不相关的,所以1的容器有n个 2 3 4。。。为0个线段树每个结点的附加信息是该区间的和本题查找出的代码是关键 比如左右子树分别为sum 27 25 ,则第26大的容器必然在左子树上,继续递归下去,则要在该左子树找 (26-25)大的容器...
2016-07-05 15:21:00
149
转载 Trie树模板 POJ1056
IMMEDIATE DECODABILITYTime Limit:1000MSMemory Limit:10000KTotal Submissions:12907Accepted:6188DescriptionAn encoding of a set of symbols is said to be im...
2016-07-05 15:04:00
98
转载 hdu1863最小生成树krus模板&prim模板
最小生成树的定义:权值和最小的连通路krus:每一步寻找原图最短路径(但是要安全边)加入 判断安全边可以用并查集#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#in...
2016-06-15 01:23:00
143
转载 hdu 3870 最小割转化为最短路径2
Catch the ThevesProblem DescriptionA group of thieves is approaching a museum in the country of zjsxzy,now they are in city A,and the museum is in city B,where keeps many broken legs of zjsxz...
2016-06-10 18:36:00
134
转载 UVALive 3661 最小割转化为最短路径
题意:动物逃跑,从左上跑到右下角,逃跑的路径是一个grid的边,现在动物园的工作人员要去拦截。input给出了grid每条路径拦截所需要的cost,题目要求拦截成功最小的成本。经典的最小割问题,但是400*400个点太大了,所以不能直接这么做lrj给出的方法是动物要从左上跑到右下,所有我们考虑怎么摆障碍物就可以了,思考可以知道,只要做左/下->右/上的连续拦截边,就可以将所...
2016-06-10 18:26:00
165
转载 UVA 1078 dij模板 +建图难
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <stack>#include <string>#include <q...
2016-06-10 15:04:00
140
转载 自用新工程模板
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <stack>#include <string>#include <q...
2016-05-26 21:17:00
108
转载 UVA 11478 bf+差分约束系统+二分逼近
HalumYou are given a directed graph G(V, E) with a set of vertices and edges. Each edge (i, j) that connects some vertex i to vertex j has an integer cost associated with that edge. Define the ...
2016-05-24 18:33:00
149
转载 UVA11090 二分逼近+bf
Going in Cycle!!You are given a weighted directed graph with n vertices and m edges. Each cycle in the graph has a weight, which equals to sum of its edges. There are so many cycles in the grap...
2016-05-23 20:55:00
110
转载 2016"百度之星" - 初赛(Astar Round2B)
1003.杨辉三角+逆元#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <stack>#include <string>...
2016-05-22 23:49:00
105
转载 2016年团体程序设计天梯赛-模拟赛
L2-1. 集合相似度stl set模板,以后复习可以看一下,当模板用了,去重很有用呀#include <cstdio>#include <set>using namespace std;set<int> s[50];int main(){ //freopen("G:\\input.in", "r", stdi...
2016-05-16 00:04:00
202
转载 2016百度之星资格赛
A.前缀hash+逆元#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <stack>#include <string>#...
2016-05-14 21:51:00
72
转载 hdu1564 找出特殊数(map模板)
Find your present!Problem DescriptionIn the new year party, everybody will get a "special present".Now it's your turn to get your special present, a lot of presents now putting on the desk, a...
2016-05-13 19:22:00
100
转载 hdu1173 中位数
采矿Problem Description某天gameboy玩魔兽RPG。有一个任务是在一个富含金矿的圆形小岛上建一个基地,以最快的速度采集完这个小岛上的所有金矿。这个小岛上有n(0<n<1000000)个金矿,每个金矿的矿藏量是相等的。而且这个小岛的地势非常平坦,所以基地可以建在小岛的任何位置,每个金矿的采矿速度只跟矿藏到基地的路程长度有关。为了不让这个任务太无聊,...
2016-05-13 19:05:00
107
转载 hdu1172 暴力枚举
猜数字Problem Description猜数字游戏是gameboy最喜欢的游戏之一。游戏的规则是这样的:计算机随机产生一个四位数,然后玩家猜这个四位数是什么。每猜一个数,计算机都会告诉玩家猜对几个数字,其中有几个数字在正确的位置上。比如计算机随机产生的数字为1122。如果玩家猜1234,因为1,2这两个数字同时存在于这两个数中,而且1在这两个数中的位置是相同的,所以计...
2016-05-13 17:15:00
111
转载 UVA 10537最小树(逆向+字典序输出)
The Toll! Revisited Sindbad the Sailor sold 66 silver spoons to the Sultan of Samarkand. The selling was quite easy; but delivering was complicated. The items were transported over land, passi...
2016-05-12 16:48:00
152
转载 UVA 1416 最短路树
Warfare And LogisticsThe army of United Nations launched a new wave of air strikes on terroristforces. The objective of the mission is to reduce enemy's logistical mobility. Each airstrike wi...
2016-05-11 20:16:00
157
转载 hdu1078 记忆化dfs
FatMouse and CheeseProblem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 &l...
2016-05-10 19:18:00
105
转载 hdu1142 dij+记忆化深搜
A Walk Through the ForestProblem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to ...
2016-05-09 22:27:00
133
转载 UVA 11374 dijkstra预处理+枚举
Airport Express In a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of trains in Airport-Exp...
2016-05-09 00:07:00
150
转载 poj1502 单源最短路径
MPI MaelstromTime Limit:1000MSMemory Limit:10000KTotal Submissions:7850Accepted:4818DescriptionBIT has recently taken delivery of their new supercomputer...
2016-05-07 21:26:00
111
转载 hdu1814 2-SAT 暴力搜
Peaceful CommissionTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2853Accepted Submission(s): 901Problem DescriptionThe Public ...
2016-05-07 18:17:00
152
转载 poj1094(去环)(唯一确定)topu排序
Sorting It All OutTime Limit:1000MSMemory Limit:10000KTotal Submissions:31940Accepted:11103DescriptionAn ascending sorted sequence of distinct values is ...
2016-05-05 20:51:00
173
转载 poj2186 强连通缩点
Popular CowsTime Limit:2000MSMemory Limit:65536KTotal Submissions:29141Accepted:11779DescriptionEvery cow's dream is to become the most popular cow in th...
2016-05-03 19:22:00
139
转载 poj2942 双联通分量+交叉染色法判断二分图
Knights of the Round TableTime Limit:7000MSMemory Limit:65536KTotal Submissions:11805Accepted:3870DescriptionBeing a knight is a very attractive career: ...
2016-05-03 00:57:00
132
转载 poj1144 tarjan求割点 裸题
NetworkTime Limit:1000MSMemory Limit:10000KTotal Submissions:11684Accepted:5422DescriptionA Telephone Line Company (TLC) is establishing a new telephone ...
2016-04-29 22:33:00
145
转载 poj2367 tupo_sort裸题
Genealogical treeTime Limit:1000MSMemory Limit:65536KTotal Submissions:4309Accepted:2866Special JudgeDescriptionThe system of Martians' blood relati...
2016-04-29 00:31:00
119
转载 hiho1433 0-k背包
#1043 : 完全背包时间限制:20000ms单点时限:1000ms内存限制:256MB描述且说之前的故事里,小Hi和小Ho费劲心思终于拿到了茫茫多的奖券!而现在,终于到了小Ho领取奖励的时刻了!等等,这段故事为何似曾相识?这就要从平行宇宙理论说起了………总而言之,在另一个宇宙中,小Ho面临的问题发生了细微的变化!小Ho现在手上有M张奖券...
2016-04-28 23:10:00
121
转载 zjgsu609
我删我删,删删删Time Limit1sMemory Limit64KBJudge ProgramStandardRatio(Solve/Submit)22.73%(5/22)Description:有一个大整数.不超过1000位.假设有N位.我想删掉其中的任意S个数字.使得删除S位后,剩下位组成的数是最...
2016-04-28 14:24:00
194
转载 pku1088 dfs+dp记忆化搜索
滑雪Time Limit:1000MSMemory Limit:65536KTotal Submissions:88861Accepted:33344DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡...
2016-04-28 00:09:00
131
转载 hdu1515 dfs栈模拟
Anagrams by StackTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1513Accepted Submission(s): 690Problem DescriptionHow can anagra...
2016-04-27 20:22:00
229
转载 hdu1410 数学题组合概率 log优化
PK武林盟主Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1250Accepted Submission(s): 303Problem Description枫之羽认为自己很强,想当武林盟主,于是找现任武林盟...
2016-04-27 15:56:00
145
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人