自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 DP动态规划问题 1300

/* HDU1300 DP 给定n种珠宝 每种珠宝两个数据,num[i]代表数量,price[i]代表单价 购买珠宝时要满足以下购买规则: 单独买:每种珠宝要加上数量10 合并买:可以把连续几种珠宝数量合并,再加上10,单价按照price最大的计算 求出购买所有的珠宝最少要花费多少 思路: 初始化:第一种珠宝 只需要管当前第i种珠宝的购买 购买方法一

2017-09-25 22:09:47 183

原创 栈stack

简单的栈typedef struct{ int data[maxn]; int top;}SqStack;void initstack(SqStack *S){ S->top=-1; return ;}void inputpush(SqStack *S){ int x; cin>>x; if(S->top==maxn-1) r

2017-09-25 16:34:07 214

原创 N维bfs

题目链接:https://nanti.jisuanke.com/t/17317第一次做这样的题目,转化为字符串的问题,进行bfs//定义个map来记录整个字符串的状态#include#include#include#include#include#include#includeusing namespace std;struct Node{ string str;

2017-09-24 23:01:26 147

原创 线段树 面积并 模板题

hdu 1542题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1542面积并不需要pushdown操作,因为不需要查询,但要pushup向上更新#include #include #include #include #define maxn 100030#define lson step<<1#define rson step<<

2017-09-24 21:33:51 173

原创 线段树 求一个序列的非递增子序列的权值和的最大值

题目链接:https://nanti.jisuanke.com/t/17319  #include#include#include#include#define lson step<<1#define rson step<<1|1#define getMID (l+r)>>1#define maxn 100005#define LL long longusing namespa

2017-09-24 20:13:17 402

原创 线段树之一段区间求两个数ax*ay的最小值

题目链接:https://hihocoder.com/contest/acmicpc2017beijingonline/problem/9简单线段树,注意两种flag,数可正可负,弄清思路,就OK了。#include#include#include#include#include#define lson step<<1#define rson step<<1|1#define

2017-09-23 22:06:50 177

原创 邻接矩阵和弗洛伊德

#include #include #include #include #include #include #include #include #include #include #define INF 9999999using namespace std;int main(){ int n,m; while(cin>>n>>m) { int count1=0

2017-09-23 11:47:18 410

原创 spfa求最短路算法

#include <iostream>#include <cstring>#include <string>#include <cstdlib>#include <map>#include <vector>#include <cmath>#include <queue>#include...

2017-09-23 11:45:37 505

原创 邻接表的最小生成树

#include //邻接表的最小生成树#include #include #include #include #define INF 0x3f3f3f3fusing namespace std;int n,m;struct node{ int to,num;};vectorv[1010];int prim(){ node d; int visit[1

2017-09-23 11:43:44 1815

原创 邻接表的最短路算法

#include #include #include #include #include #include #include #define INF 99999999using namespace std;struct node{ int to; int weight;}p;int main(){ vectorv[205];//邻接表的最短路算法 int boo

2017-09-23 10:57:09 690

原创 静态链表系列操作

静态链表#include #include using namespace std;#define maxn 105typedef struct{ int data; int cur;}stackLinkList;void init(stackLinkList *L){ for(int i=0;i<maxn-1;i++) L[i].cur=i+1;

2017-09-20 20:24:06 221

原创 顺序表及系列操作

顺序表#include #include using namespace std;typedef struct{ int data[1005]; int length;}SqList;void input(SqList *p){ int x; cin>>x; int i=0; p->length=0; while(x!=-1)

2017-09-20 20:15:30 198

原创 单链表及系列操作

#include #include using namespace std;typedef struct Node{   int data;   struct Node *next;}Node, *LinkList;void input1(LinkList *head){   LinkList p,r;   int x;   cin>>x;

2017-09-19 21:53:05 370

空空如也

空空如也

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

TA关注的人

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