自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 9-Prototypes analyze 二叉排序树

题目描述:ALpha Ceiling Manufacturers (ACM) is analyzing the properties of its new series of Incredibly Collapse-Proof Ceilings (ICPCs).An ICPC consists ofnlayers of material, each with a different v...

2019-04-21 21:37:22 108

原创 计算几何 dls

实数比较#define double dbconst db EPS=1e-9;int sign(db a){ return a<-EPS?-1:a>EPS };int cmp(db a,db b){ return sign(a-b)};点struct P{ db x,y; P(){} P(db _x,db _y):x(_x),y(_y){} P opera...

2019-04-18 12:22:01 294

原创 poj1463 Strategic game 树形dp

Time Limit:2000MS Memory Limit:10000K Total Submissions:10111 Accepted:4761 DescriptionBob enjoys playing computer games, especially strategic games, but sometimes he cannot ...

2019-04-16 16:00:22 107

原创 Codeforces Round #398 (Div. 2) 767C 树形dfs

Once at New Year Dima had a dream in which he was presented a fairy garland. A garland is a set of lamps, some pairs of which are connected by wires. Dima remembered that each two lamps in the garland...

2019-04-16 09:26:06 99

原创 桂林电子科技大学第三届ACM程序设计竞赛 二元 贪心

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述小猫在研究二元组。小猫在研究最大值。给定N个二元组(a1,b1),(a2,b2),…,(aN,bN),请你从中选出恰好K个,使得ai的最小值与bi的最小值之和最大。请输出ai的最小值与bi的最小值之和输入描述:第一行...

2019-04-15 21:21:36 260

原创 桂林电子科技大学第三届ACM程序设计竞赛 点对 floyd

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述小猫在研究有向图。小猫在研究联通性。给定一张N个点,M条边的有向图,问有多少点对(u,v)(u<v),满足u能到达v且v也能到达u。输入描述:第一行两个正整数N,M,表示点数与边数。接下来M行,第i行两个正整数ui,v...

2019-04-14 17:17:53 298

转载 double等浮点数比较问题,eps

https://blog.csdn.net/major_zhang/article/details/65449685

2019-04-11 21:23:40 262

原创 poj2449 Remmarguts' Date 第K短路(A*算法)

求从s点到e点的第k条最短路。这里是最短路的典型变形之一:A*算法。A*算法是一种启发式搜索,不是纯粹的盲目搜索。A*算法中有个估值算法g(n),对于每个点而言,都有一个g(n)和h(n)来确定的f(n),实际上就是以f(n)为参考权值来确定搜索的方向,在这里,h(n)表示的是从s点出发到这个点n现在走过的路径长度,而g(n)表示的是从n到e的最短长度的大小,那么就确定了搜索的优先性,这里的A*算...

2019-04-10 22:32:02 139

原创 邻接表的两种实现方法

1.用数组head[MAXN],next[MAXM];// head[v]记录表头节点v的第一条边的标号,next[u]标号为u的边的下一条边。struct node{ int s,e,w; node(int s,int e,int w){ this->s=s; this->e=e; this->w=w; } node(){}}t[MAXM];void a...

2019-04-09 12:38:05 377

原创 poj1511 Invitation Cards SPFA

http://poj.org/problem?id=1511先一次用SPFA求早上从定点1到各点的最短路径和,再对其求反向图,用SPFA求一次顶点1到各顶点的最短路径和,这个值其实就是晚上各点回到顶点1的最短路径和了。#include <cstdio>#include <cstring>#include <algorithm>#include &...

2019-04-09 12:25:54 99

原创 SPFA求最短路及判定负环

为什么能够判负环?根据原理,每个最短路都不会超过n-1条边,如果说超过了n-1条边的话,那么就说明走了重点,即走了环,因此就可以知道里面产生了负环,才使得这个最短路无解。SPFA对这个算法很好地进行了优化。优化的根源在于,能够改变最短路的路径都是之前成功松弛过的点,也就是说,如果一个点被成功地松弛了,那么这个点才有可能松弛其它边,没有被松弛的点,就说明这个点所记录的最短路径没有改变,那么以...

2019-04-08 21:52:41 425 1

原创 dijkstra的邻接表实现和堆优化

时间复杂度O(eloge),在n的数量级>=1e5时必须采用这种堆优化+邻接表方式 。int vis[MAXN];int pre[MAXN];//前驱节点int dis[MAXN];//距离源的长度struct node{ int vex,w;//节点和距离源点的最优距离 friend bool operator < (node a,node b){//重载运算符,使其...

2019-04-07 20:16:22 310

原创 9-表达式求值

http://nyoj.top/problem/1272#include <iostream>#include <stack>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;const int maxn=1005;...

2019-04-03 21:09:06 124

原创 poj2082 Terrible Sets

#include <iostream>#include <cstdio>#include <algorithm>#include <stack>using namespace std;const int maxn=50005;struct node{ int w,h;}data;int main(){ int n,ans,tot...

2019-04-02 22:30:14 133

转载 各种二分查找的区别

https://www.cnblogs.com/luoxn28/p/5767571.html

2019-04-02 15:17:15 240

原创 poj1159 Palindrome 线性dp+滚动数组

#include <iostream>#include <cstring>#include <string>#include <algorithm>using namespace std;const int maxn=5005;int n;string s1,s2;int dp[2][maxn];//dp[i][j]只依赖于dp[i...

2019-04-02 14:23:13 95

原创 常用的string类型函数

#include <iostream>#include <string>#include <cstring>#include <algorithm>using namespace std;string s1,s2;int main(){ cin>>s1>>s2; reverse(s1.begin(),s1.e...

2019-04-02 13:57:08 292

原创 poj 2479 Maximum sum

// c++输入输出超时#include <cstdio>#include <algorithm>using namespace std;const int maxn=50005;int T,n;int a[maxn];int l[maxn];int r[maxn];int main(){ scanf("%d",&T); while(T--)...

2019-04-01 22:18:13 85

空空如也

空空如也

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

TA关注的人

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