![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM模板
UCAS王小二
不念过去,不畏未来...
展开
-
浅谈线段树+模板
推荐两篇线段树博文: 线段树之一; 线段树之二;小结: 线段树是一种二叉树,也可以说成是区间树,操作有:建树build,更新updata(单点+区间),查询query(单点+区间)。单点操作时把区间不断二分,用root指向数组下标;区间更新操作时,标记lazy,先对子树的根节点做更新,当用到的这个子树的时候,再把标记下推,同时递归时向上统计,更新区间;区间查询时,会有遍历的一个操作遇到l...原创 2018-01-31 15:40:23 · 427 阅读 · 0 评论 -
HAUT 1289: arufuonsusnoufura【LCS+dp回文串】
1289: arufuonsusnoufura时间限制: 10 秒 内存限制: 128 MB题目描述爱德华有一天遇到了一个难题,他准备给弟弟送一个项链,不过炼金术师都有这么一个小爱好:喜欢对称,他希望买到的项链也是对称的,不过集市上左右对称的项链早就卖光了。聪明的爱德华准备随便买来一个自己取下几颗珍珠变成对称的。由于取下之后再安回去很麻烦,所以请你计算一下最少取下几枚珠子可以将...原创 2017-09-12 22:38:23 · 222 阅读 · 0 评论 -
hpu 1082: 循环数组最大子段和 [DP]
1082: 循环数组最大子段和 [DP]时间限制: 1 Sec 内存限制: 128 MB题目描述KACA在做了最大子段和问题之后,思考若数组可以首尾相接的话最大子段和应该是多少。输入有多组测试数据。每一组的第一行是一个整数nn。下面一行是nn个以空格分开的整数aiai。1≤N≤100000≤|ai|≤106输出对于每一组数据,输出当数组可以首位相接时的最大子段和,占一行。样例输入6-1 4 -...原创 2016-12-28 00:29:05 · 366 阅读 · 0 评论 -
hdu 2050 折线分割平面
折线分割平面Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28863 Accepted Submission(s): 19607Problem Description我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们...原创 2017-02-19 22:39:26 · 361 阅读 · 0 评论 -
华为笔试题【01背包+贪心+记录路径】
题目:给你一堆app和你的手机容量,一堆app有下载容量和得到的相应金币奖励,求你想要得到最多的金币,输出这个选择路径(输入次序就是对应的编号,相同容量相同金币的app选择编号较小的下载)。 思路: 记录路径是可以,但是会被覆盖,这个覆盖是从后向前的覆盖,所以把最优的贪心到后面,进行覆盖的时候,记录下的路径是最优路径。#include <bits/stdc++.h>usi...原创 2018-04-07 09:18:41 · 562 阅读 · 0 评论 -
poj 1787 Charlie's Change【多重背包可行性+记录路径】
DescriptionCharlie is a driver of Advanced Cargo Movement, Ltd. Charlie drives a lot and so he often buys coffee at coffee vending machines at motorests. Charlie hates change. That is basically the ...原创 2017-08-14 20:41:44 · 1531 阅读 · 0 评论 -
Codeforces Round #462 (Div. 2)
A. A Compatible Pair Nian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill the...原创 2018-02-17 22:08:43 · 184 阅读 · 0 评论 -
zzuli 1731: 矩阵【二维树状数组】
zzuli 1731: 矩阵; 分析:二维树状数组入门题,由于修改次数比较少,暴力+一定技巧 也可以解;#include <bits/stdc++.h>using namespace std;typedef long long LL;const int MAXN = 1000 + 10;int tree[MAXN][MAXN], arr[MAXN][MAXN]; ...原创 2018-04-27 17:55:42 · 175 阅读 · 0 评论 -
CodeForces - 348D Turtles【DP+LGV】
题意:给你一个矩阵(#表示不可走),两只乌龟从左上角出发到达右下角,中间不能相遇,存在多少种不同的方案,也就是两条不相交的路径的方案数. 分析: LGV:(https://en.wikipedia.org/wiki/Lindstr%C3%B6m%E2%80%93Gessel%E2%80%93Viennot_lemma) ps:我自己也不是很懂原理,但是知道怎么用,就说一下吧. 给定n个起点...原创 2018-07-20 15:59:30 · 514 阅读 · 0 评论 -
CodeForces 711C Coloring Trees【dp*好题】
ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers ...原创 2017-11-18 14:24:26 · 492 阅读 · 0 评论 -
Wannafly挑战赛10 B 小H和密码【二维dp*好题】
链接:https://www.nowcoder.com/acm/contest/72/B 来源:牛客网 题目描述 小H在击败怪兽后,被一个密码锁挡住了去路 密码锁由N个转盘组成,编号为1~N,每个转盘有M个位置,每个位置上要么有一个小写字母,要么没有任何字符。一个密码能被转盘表示出,当且仅当指定每个转盘上面的某一个位置,然后将这些位置按照所属的转盘编...原创 2018-03-06 21:42:31 · 294 阅读 · 0 评论 -
SPOJ Query on a tree【树链剖分】
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3…N-1.We will ask you to perfrom some instructions of the following form:CHANGE i ti : change th...原创 2018-04-12 22:22:02 · 135 阅读 · 0 评论 -
HDU 2586 How far away ?【LCA入门】
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How far is it if I want to go from house A to house B”? Usually it hard...原创 2018-04-11 21:23:10 · 165 阅读 · 0 评论 -
Codeforces Round #467 (Div. 2)【A B C D】
A - Olympiad The recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine ...原创 2018-03-08 08:45:24 · 495 阅读 · 0 评论 -
hdu 6040 Hints of sd0061【STL线性排序函数】
Hints of sd0061Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1595 Accepted Submission(s): 466Problem Descriptionsd0061, the legend of Beihang U...原创 2017-07-27 09:07:01 · 416 阅读 · 0 评论 -
Wannafly挑战赛13【A B C D】【逆元+数学+优先队列】
A zzy的小号 链接:https://www.nowcoder.com/acm/contest/80/A 来源:牛客网 题目描述 学家zzy根据字体的特点,创建了一系列小号… I_Love_Chtholly! 又到了打wannafly的时候,许许多多的大佬准备注册小号开始虐场,zzy也不例外,他发现他的电脑的字体有一个特点!某些不同的字符所显示的是一样的! ...原创 2018-04-08 14:17:46 · 359 阅读 · 0 评论 -
Codeforces Round #469 (Div. 2) C Zebras【贪心】
A. Zebras time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output Oleg writes down the history of the days he lived. For each day he decides if it...原创 2018-03-12 17:45:31 · 209 阅读 · 0 评论 -
codeforces 754D Fedor and coupons【优先队列+贪心*好题】
D. Fedor and couponstime limit per test4 secondsAll our characters have hobbies. The same is true for Fedor. He enjoys shopping in the neighboring supermarket.The goods in the supermarket have unique ...原创 2017-11-09 17:48:19 · 357 阅读 · 0 评论 -
CodeForces - 777B Game of Credit Cards 田忌赛马之二
在第四个赛季之后,Sherlock和Moriary已经意识到他们之间的战斗的整体愚蠢,并决定继续在和平的信用卡游戏中的比赛。这个游戏的规则很简单:每个玩家都带他最喜爱的n位信用卡。然后两位玩家一个一个地将他们的卡上写的数字命名。如果两位数字不相等,则数字较小的玩家将从另一名玩家中轻拍(通常用食指敲击前额)。例如,如果n = 3,Sherlock的卡是123,Moriarty的卡有321号,第一个S...原创 2017-04-21 13:44:56 · 412 阅读 · 0 评论 -
JAVA大数+常用函数
推荐:java中的BigIntegertest 1题目描述:输入两个非常大的实数A和B,判断A是否等于B;import java.math.BigDecimal;import java.util.Scanner;public class Main { public static void main(String[] args) { BigDecimal a, b...原创 2018-11-07 12:14:14 · 256 阅读 · 0 评论