自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

爱梦者的心之旅

这里记载我的回忆

  • 博客(16)
  • 收藏
  • 关注

原创 hdu 1004 Max Sum 基础dp

题目链接 最大子序列和。 输出起始位置。 #include #include #include using namespace std; #define N 100005 #define inf 0x3f3f3f3f int a[N]; int dp[N]; int pre[N]; int main() { int T,iCase=0; sca

2017-10-29 19:35:17 300

原创 UVA 11400 Lighting System Design

#include #include #include using namespace std; #define N 100005 #define inf 0x3f3f3f3f int dp[N]; struct data { int v,k,c,l;///电压 电源费用 灯泡费用 数量 friend bool operator <(data a,data b) {

2017-10-25 12:41:44 237

原创 UVA 12563 Jin Ge Jin Qu hao

题目分析: 最多的唱歌次数 数据水,只是卡空间范围但是没有卡时间范围。 利用完全背包的思想每次截取一个。 for(int i=1; i<=n; i++) { for(int j=t-1; j>=a[i]; j--) { dp[j]=max(dp[j],dp[j-a

2017-10-23 23:50:24 195

原创 UVA 1025A Spy in the Metro 动态规划 _ SPFA

传送门 Description Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City

2017-10-23 17:54:37 256

原创 DAG 动态规划 -- 硬币问题

#include #include using namespace std; #define N 1005 int dp[N]; int a[N]; int main() { memset(dp,0,sizeof(dp));///dp[i] 存储从0 到i所需要的最小(inf)/最大硬币数(0) int n,Aims;/// n : 硬币的种类数 Aims 目标值 scan

2017-10-22 10:47:47 319

原创 NYoj 16 矩形嵌套 (DAG上最长路 - 动态规划)

矩形嵌套 时间限制:3000 ms  |  内存限制:65535 KB 难度:4 描述有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b<d或者b<c,a<d(相当于旋转X90度)。例如(1,5)可以嵌套在(6,2)内,但不能嵌套在(3,4)中。你的任务是选出尽可能多的矩形排成一行,使得除最后一个外,每一个矩

2017-10-22 10:30:00 230

原创 UVA 437 The Tower of Babylon

题目链接 dp[u]  从u方块开始的最高的高度 dfs 版本dp【】 #include #include #include using namespace std; #define N 1005 struct Rec { int x,y,h; } a[3*N]; int pre[N]; int n; int Rel[3*N][3*N]; int dp[N]; boo

2017-10-21 15:31:20 217

原创 UVA 116 Unidirectional TSP

记录路径。。 字典序最大。。 #include #include #include using namespace std; #define N 1005 #define inf 0x3f3f3f3f int Next[N][N]; int maps[N][N]; int dp[N][N]; int main() { int n,m; while(~scanf(

2017-10-21 13:05:52 175

原创 UVA 1347 Tour (双调欧几里得旅行商问题)

dfs 版dp #include #include #include #include using namespace std; #define N 1005 double x[N]; double y[N]; double d[N][N]; int n; double dis(int i,int j) { return hypot(x[i]-x[j],y[i]-y[j]); } ///

2017-10-20 23:52:55 269

原创 hdu 2066 一个人的旅行 Dijkstra+优先队列优化

一个人的旅行 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 41287    Accepted Submission(s): 14035 Problem Description 虽然草儿是个路痴(就是在杭电待了一

2017-10-12 21:13:14 321

原创 hdu 1874 畅通工程续 (Dijkstra + 优先队列优化)

hhh,写板子专用题。。 畅通工程续 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 58019    Accepted Submission(s): 21811 Problem Description

2017-10-12 17:37:33 227

原创 优先队列 使用 (补一发)

优先队列的原理就是堆。 默认的优先队列是最小二叉堆。 #include #include #include #include #include using namespace std; struct data { int x,y; data(int x,int y){ this->x=x; this->y=y; } friend

2017-10-12 00:32:32 243

原创 hdu 5952 Counting Cliques

Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2630    Accepted Submission(s): 966 Problem Description A clique i

2017-10-07 17:39:21 234

原创 hdu 3605 Escape (二分图匹配)

Escape Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 11348    Accepted Submission(s): 2733 Problem Description 2012 If this is th

2017-10-03 12:02:25 235

原创 玩一玩 题解

1. #include int main() { int a,b,c; while(~scanf("%d%d%d",&a,&b,&c)) { printf("%d\n",a+b-c); } } 2. #include #include #include using namespace std; int main() { char st

2017-10-03 11:34:35 342

原创 hdu 5889 Barricade (最短路的最小割)

Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1967    Accepted Submission(s): 570 Problem Description The empire is und

2017-10-02 15:08:25 333

空空如也

空空如也

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

TA关注的人

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