随笔分类 - ACM
努力的人运气一般运气不会太差0.-
摘要:状态转移方程: 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])
阅读全文
摘要:A.hdu1003 Max Sum dp求最大序列和 dp[i] = max(dp[i-1],0)+a[i] ps.dp[i]当前元素结尾的最大序列和 mmax = max(mmax,dp[i]) 讲的不清楚,可以看看别人的思路 http://alorry.blog.163.com/blog/sta
阅读全文
摘要:A.Reciprocal cycles 求小数循环节的方法 #include <iostream> #include <cstdio> #include <cstring> #include <string> using namespace std; const int MAXN = 1e4+100
阅读全文
摘要:Floyd : City of Blinding Lights 重点距离为0 平时都不用floy,一到用时,竟然写不来。。。 #include <cstdio> #include <iostream> #include <string> #include <cstring> #include <al
阅读全文
摘要:http://codeforces.com/problemset/problem/688/B 5k人以上做出来的大水题,题目还是非常有爱的,找规律,发现2-digit有9个,4-digit有90个,然后就是900,9000的序列 题目要求最k个序列是什么,比如980个,必然是是在3-gidit内(9
阅读全文
摘要:A. Multiples of 3 and 5 大水题,计算出below n内是3,5倍数的总和 数据较大,只能用求和公式 #include <iostream> #include <cstdio> typedef long long ll; using namespace std; int mai
阅读全文
摘要:A.贪心 B.b题我昨晚看两个队友都没写出来,早上看觉得挺简单的,天真以为是要以ai结尾的连续的,wa1...然后知道是可以不连续的,做着做着忘了是要以ai结尾的,以为是前面的子序列最长就可以了,wa4... 其实如果了解O(nlogn)的算法就可以很快想出来了,亏我还是写过模板的人,各种wa我也是
阅读全文
摘要:最近忙于写题和被虐,还有懒,好久没有更新博客了,昨天被虐了一整天,整个人都是迷茫状态,好好补cf吧 发现挺有意思的 这题就是cur点可以到cur-1,cur+1,a[cur]三个位置,求最短路径问题 题目数据量较大,当时没想到可以用bfs,也是好久没有用纯搜索了,时间复杂度不会算呀,我以为会超的or
阅读全文
摘要:其实这题之前做过,线段树一直不熟,所以也一直没有搞懂 本题的关键是线段树原始区间代表的是每一种容器(size不同)的数量 比如 刚开始都是互不相关的,所以1的容器有n个 2 3 4。。。为0个 线段树每个结点的附加信息是该区间的和 本题查找出的代码是关键 比如左右子树分别为sum 27 25 ,则第
阅读全文
摘要:IMMEDIATE DECODABILITY Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12907 Accepted: 6188 Description An encoding of a set of symbols is
阅读全文
摘要:最小生成树的定义:权值和最小的连通路 krus:每一步寻找原图最短路径(但是要安全边)加入 判断安全边可以用并查集 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath>
阅读全文
摘要:Catch the Theves Problem Description A group of thieves is approaching a museum in the country of zjsxzy,now they are in city A,and the museum is in c
阅读全文
摘要:题意:动物逃跑,从左上跑到右下角,逃跑的路径是一个grid的边,现在动物园的工作人员要去拦截。input给出了grid每条路径拦截所需要的cost,题目要求拦截成功最小的成本。 经典的最小割问题,但是400*400个点太大了,所以不能直接这么做 lrj给出的方法是动物要从左上跑到右下,所有我们考虑怎
阅读全文
摘要:#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <string> #include <queue> #incl
阅读全文
摘要:#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <string> #include <queue> #incl
阅读全文
摘要:Halum You 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
阅读全文
摘要: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
阅读全文
摘要:L2-1. 集合相似度 stl set模板,以后复习可以看一下,当模板用了,去重很有用呀 #include <cstdio> #include <set> using namespace std; set<int> s[50]; int main(){ //freopen("G:\\input.in
阅读全文
摘要:A.前缀hash+逆元 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <string> #include <
阅读全文
摘要:Find your present! Problem Description In the new year party, everybody will get a "special present".Now it's your turn to get your special present, a
阅读全文

浙公网安备 33010602011771号