自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 最短路径之spfa

其实就是用队列对Bellman-Ford进行优化:  #include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <vector>#include <queue>using namespace st...

2018-08-24 21:38:58 420

转载 最短路径之floyd

floyd's algorithm 写起来非常的简单,理解起来也比较容易:自己写的代码:#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <vector>using namespace std;st...

2018-08-24 20:22:26 530

原创 最短路径之bellman—ford

bellman-ford's algorithm复杂度为O()比Dijkstra's algorithm 慢,但其可用于计算有负权边时的最短路主要就是三个部分:1.初始化所有的dis[ v ]=INF,dis[ v ]为v点到源点的距离,并令dia[start]=0,源点的距离为0;2.对于每条边进行n-1次松弛操作; dis[v]=min(dis[v],dis[u]+w);该操作即为...

2018-08-24 17:45:49 259

原创 图的表示方法

不会时很难,会了就变的很简单

2018-08-24 15:37:01 1735

原创 最短路径算法之Dijkstra's algorithm

Dijkstra's algorithm主要用来解决单源最短路径的问题,并且不可以用于包含负权值的图。主要思想就是:把一个图上的点分成两类,一类是最短路径树上所包含的点记作集合S,另一类当然就不是最短路径上的点记作集合V;怎么确定哪个点能够属于S呢?遍历图上的所有的点,找出距离起始点的路径最短的那个点,把他放入集合S中,然后在更新图上所有点离起始点的距离信息,就是比较经过刚刚放入S中的这个点和...

2018-08-23 16:56:29 9178 1

原创 简单搜索之dfs、bfs

dfs: #include <iostream>#include <cstdio>#include <vector>#include <cstring>#include <string>#include <algorithm>#include <stack>using namespace st

2018-08-22 17:15:16 207

转载 并查集

并查集的简要概括

2018-08-20 20:29:17 149

原创 最小生成树

Kruskal模板#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <algorithm>#include <cmath>#define maxn 2000000using namespace s...

2018-08-18 18:18:39 109

原创 D - 十四大师 (简单的bfs也可以用dfs)

还是粗心呀,bfs,和dfs一定要熟练掌握

2018-08-01 18:49:05 235

原创 B - 迷宫路径

还不是很熟练dfs,bfs,要继续努力

2018-08-01 17:25:42 137

原创 C - 红与黑

一定要熟练掌握bfs,dfs,加油,希望下次不要这么粗心了

2018-08-01 17:19:33 1497

原创 H - Perfect Number

这么简单的题,我竟然花了够长的时间,真得问问自己脑袋~~~~~还是得加油,想起一句居里夫人的名言:不管怎样的艰难,我们必须相信我们是有天赋的,后面忘了………………

2018-07-31 17:24:16 410

原创 B - Dropping tests

只是一个简单的题,我就付出了极大的代价,唉,水平太菜,什么时候能才能稍稍牛X一点呢???

2018-07-31 17:02:53 195

原创 B. Planning The Expedition

http://codeforces.com/contest/1011/problem/BNatasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant.The warehouse has mm daily f...

2018-07-30 15:44:11 364

原创 F - Team Queue (下)

https://vjudge.net/contest/240386#problem/F看了题解后改的(还是WA):#include <iostream>#include <string>#include <algorithm>#include <stdio.h>#include <map>#include <qu...

2018-07-27 20:24:34 149

原创 F - Team Queue(上)

https://vjudge.net/contest/240386#problem/FQueues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, though it occurs...

2018-07-27 20:23:41 138

原创 Rails (栈)

https://vjudge.net/contest/240386#problem/CThere is a famous railway station in PopPush City. Country there is incredibly hilly. The stationwas built in last century. Unfortunately, funds were extr...

2018-07-27 19:22:10 333

原创 Bicycle Race(几何数学)

http://codeforces.com/problemset/problem/659/DD. Bicycle RaceMaria participates in a bicycle race.The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know,...

2018-07-27 17:08:01 390

转载 STL(set)

转载自https://www.cnblogs.com/omelet/p/6627667.htmlset的特性是,所有元素都会根据元素的键值自动排序,set的元素不像map那样可以同时拥有实值(value)和键值(key),set元素的键值就是实值,实值就是键值。set不允许两个元素有相同的键值。set的各成员函数列表如下:1. begin()--返回指向第一个元素的迭代器2. cl...

2018-07-27 15:40:36 554

转载 STL(map)

转载自https://www.cnblogs.com/fnlingnzb-learner/p/5833051.htmlMap是STL的一个关联容器,它提供一对一(其中第一个可以称为关键字,每个关键字只能在map中出现一次,第二个可能称为该关键字的值)的数据 处理能力,由于这个特性,它完成有可能在我们处理一对一数据的时候,在编程上提供快速通道。这里说下map内部数据的组织,map内部自建一颗红黑...

2018-07-27 15:22:35 131

转载 STL(容器)

转载自http://blog.csdn.net/phunxm/article/details/5081472容器的概念所谓STL容器,即是将最常运用的一些数据结构(data structures)实现出来。容器是指容纳特定类型对象的集合。根据数据在容器中排列的特性,容器可概分为序列式(sequence)和关联式(associative)两种。迭代器是一种检查容器内元素并遍历元素的数...

2018-07-27 11:05:57 94

转载 STL总览

一、STL简介STL(Standard Template Library,标准模板库)是惠普实验室开发的一系列软件的统称。它是由Alexander Stepanov、Meng Lee和David R Musser在惠普实验室工作时所开发出来的。现在虽说它主要出现在C++中,但在被引入C++之前该技术就已经存在了很长的一段时间。 STL的代码从广义上讲分为三类:algorithm(算法...

2018-07-27 10:20:17 141

原创 A - Where is the Marble? (vector)

Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them. At the beginning, Raju would place the marbles one after another in ascending order of the number...

2018-07-25 23:13:09 146

原创 G - Ugly Numbers

https://vjudge.net/contest/240386#problem/GUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ...shows the first 11 ugly numbers. By c...

2018-07-25 21:35:09 354

原创 Longest Ordered Subsequence

http://poj.org/problem?id=2533DescriptionA numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai...

2018-07-25 16:25:28 156

原创 Tanya and Toys (贪心)

http://codeforces.com/problemset/problem/659/CIn Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy fr...

2018-07-23 17:39:26 283

原创 Qualifying Contest (结构体的排序)

http://codeforces.com/problemset/problem/659/BVery soon Berland will hold a School Team Programming Olympiad. From each of the m Berland regions a team of two people is invited to participate in the...

2018-07-23 15:40:48 261

原创 Beautiful Paintings

http://codeforces.com/problemset/problem/651/BThere are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that a visitor becomes happy every time he passes from a...

2018-07-23 10:42:00 200

原创 Greatest Common Increasing Subsequence (HDU - 1423 )

http://acm.hdu.edu.cn/showproblem.php?pid=1423This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.InputEach sequence is described with M - its le...

2018-07-21 20:02:13 95

原创 基础数据类型范围

 8/16位系统1.     int(2个字节)-(2^15-1)~(2^15-1),即-32767~32767,数量级3*10^42.     unsigned  int(2个字节) 0~(2^16-1),即0~65535,数量级6*10^4.3.     long int(4字节):-(2^31-1)~(2^31-1),即-2147483647 ~2147483647,数量级:2*...

2018-07-20 10:03:20 2870 1

原创 数学递推

被机智的逼哥发现后,旋少很不甘心把自己的辛苦的血汗钱发出去,但是又不得不吐出来。于是他打算把这些钱发出去,但是不是简单的发红包。 为了活跃气氛,他决定这样发红包这: 首先,先发一个小红包(每人一分钱)假设所有人都先后随机的领取了 然后,他会把红包的领取时间排序 最后,如果领取时间排序的序号就是AC红包里面的排名,那么“恭喜你,你变成了旋少的有缘人”有缘人会平分得到旋少所有的“血汗钱”。 这活动...

2018-06-02 21:29:35 256

原创 数学类

小喵有很多女朋友。有一天,小喵想给女朋友们发玫瑰花。由于一些不(ni)知(dong)道(de)的原因,小喵想按照以下规律给它的已排好序的N个女朋友们发玫瑰花:给第一个女朋友发一支玫瑰花,给第二个女朋友发两支,给第三个女朋友发三支…现在小喵想知道连续的几个女朋友手中的玫瑰花总和为M的所有可能,你能帮助小喵吗? Input输入包含多组测试数据。每组测试数据包含两个整数N,M( 1 <= N, M...

2018-06-02 18:04:26 335

原创 字符的输入输出,continue的重要

点击打开链接 Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever faced was keeping himself alive. In order for him to survive, he decided to create one of the first c...

2018-06-02 17:11:29 137

空空如也

空空如也

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

TA关注的人

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