自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 概率/期望 dp SDUT2623 与普通DP没太大差别

The number of stepsDescriptionMary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms …). Now she stands at the top point(the first layer), and the KEY o

2020-09-07 21:07:55 108

原创 dp 最长上升子序列优化 SDUT2607

Mountain SubsequencesDescriptionCoco is a beautiful ACMer girl living in a very beautiful mountain. There are many trees and flowers on the mountain, and there are many animals and birds also. Coco like the mountain so much that she now name some letter

2020-09-07 21:06:43 117

原创 Subway 没想到地铁只能在相邻两站走

You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don’t want to be late for class, you want to know how long it will

2020-06-16 14:58:09 239

原创 逆元 快速幂 (b/a)%p=(b%p)*(a^-1%p)=(b%p)*(a^p-2%p)

题目描述多多喜欢行走,有一天老师问他一个问题:在一个方格点阵中,左上角点的坐标为(1, 1),行坐标从上到下依次递增,列坐标从左到右依次递增,每次行走可以向上、下、左、右移动一格。现在要从(1, 1)点走到(N, M)点,在行走步数最少的情况下,有多少种行走方法?(答案可能过大,请对答案取模1000000007)输入描述:第一行输入一个正整数 T,代表询问次数 (1 ≤ T ≤ 100000)接下来 T 行,每行输入两个正整数 N,M (1 ≤ N ≤ 106,1 ≤ M ≤ 106)输出描述:对

2020-06-15 16:20:43 275

原创 不怎么用的bfs 查找最优解

链接:https://ac.nowcoder.com/acm/contest/5929/C来源:牛客网题目描述众所周知,新型冠状病毒的传染性比较强。有一天多多想出家门买东西,但是从家到超市可能会经过高危地段,他想远远的避开这些高危地段并且走最少的路到达超市。多多每次可以向上、下、左、右四个方向移动。如果一个地段高危,那么多多不会通过高危地段自身及其八个方向的地段。(高危地段自身以及上、下、左、右、左上、左下、右上、右下的地段都不能通过) 如果超市位于高危地段的八个方向内,那么多多不能到达超市。

2020-06-15 15:00:02 306

原创 区间dp----括号匹配Brackets

We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,if s is a regular brackets sequence, then (s) and [s] are regular brackets sequences, andif a and b are regular brackets sequences

2020-05-31 11:14:23 172

原创 dp-Find The Marble

Alice and Bob are playing a game. This game is played with several identical pots and one marble. When the game starts, Alice puts the pots in one line and puts the marble in one of the pots. After that, Bob cannot see the inside of the pots. Then Alice ma

2020-05-29 10:15:56 153 1

原创 算法-dp The Staircases

One curious child has a set of N little bricks. From these bricks he builds different staircases. Staircase consists of steps of different sizes in a strictly descending order. It is not allowed for staircase to have steps equal sizes. Every staircase cons

2020-05-29 09:22:27 141

原创 排序(冒泡、选择、插入、希尔、快排、归并)

#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define random(x) (rand()%100)int a[15],n;void BubbleSort(){ int cmp=0,exc=0; for(int i=0;i<n;i++){ int x=0; for(int j=0;j<n-1-i;j++){ cmp++;

2020-05-29 09:16:47 2785

原创 算法-数论基础 gcd,exgcd,快速幂,龟速乘

最大公约数int gcd (int a, int b) { return b ? gcd (b,a % b) : a;}最小公倍数int lcm(int a,int b){ return a/gcd(a,b)*b;//先做除法,防止数太大超范围}求ax+by=c的

2020-05-24 11:34:38 246

原创 算法-并查集删点操作 虚拟父点

Recognizing junk mails is a tough task. The method used here consists of two steps:Extract the common characteristics from the incoming email.Use a filter matching the set of common characteristics extracted to determine whether the email is a spam.We

2020-05-22 15:36:19 186

原创 算法-带权并查集 食物链

动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句话有的是真的,有的是假的。当一句话满足下列三条之一时,这句话就是假话,否则就是真话。1) 当前的话与前面的某些真

2020-05-22 13:52:30 140

原创 算法-最小生成树 prim+kruskal

某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每行给出一对正整数,分别是两个村庄的编号,以及此两村庄间的距离。为简单起见,村庄从1到N编号。当N为0时,输入结束,该用例不被处

2020-05-22 13:48:19 148

原创 POJ - 2240 huan

Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 Britis...

2019-08-12 10:52:25 107

转载 树状数组求逆序数+离散化

逆序对指的是一个序列中有两个数ai和aj,i<j&&ai>aj,即它们下标与数值的增减不一致,那么对于这个问题:求一个序列中逆序对的个数,该如何解决呢?树状数组求逆序的思想事实上和树状数组关系不大,以下图为例(自己画的,丑:):如上图,第一次将第一个数1对应的a[1]++,这时还看不出来,再将4对应的a[4]++,同理a[2]++……即将n对应的a[n]++,这样做...

2019-08-12 10:52:15 99

原创 最小生成树 HDU - 1875 百岛湖

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小...

2019-08-12 10:52:07 100

原创 D - Count Color 区间有几种颜色(01串)

Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L centimeter, L is ...

2019-08-12 10:51:57 139

原创 差分+树状数组F - A Simple Problem with Integers

You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the su...

2019-08-12 10:51:34 120

原创 树的直径 Cow Marathon poj-1985

这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入欢迎使用Ma...

2019-08-12 10:50:04 128

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除