自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

剑似生平

自庇一身青箬笠,相随到处绿蓑衣。斜风细雨不须归

  • 博客(17)
  • 资源 (3)
  • 收藏
  • 关注

原创 如何用java打印出JSON文件

应老师要求,需要打印出被剪枝的结点,临时上网上查了资料,我们需要下面的东西: 1.org.json.jar 下载之后把所有文件单独放在项目新建的文件夹org.json下即可。 2.我们需要知道两个类: JSONObject和JSONArray (1)JSONObject是用{}包起来的,而JSONAr...

2019-05-21 22:38:34 3793

原创 UVA12563

这道题是普通的0-1背包问题,但是需要注意的是我们要求最多曲目下最长的歌的时间。所以当曲目数相同时,要取最长的时间。#include <iostream>#include <bits/stdc++.h>#define maxn 100000#define INF 0x3f3f3f3fusing namespace std;int w[60];i...

2019-05-17 09:06:02 227

原创 LIS

d[i]表示下标为I的数前最大的子序列的长度。结果是max{d[i]}#include <iostream>#include <bits/stdc++.h>#define INF 0x3f3f3f3fusing namespace std;const int maxn = 1e4;int d[maxn];int a[1010];int main()...

2019-05-17 08:56:56 505

原创 Charm Bracelet POJ - 3624

这种题目一开始是用二维数组写的,但是会超时。后面用一维数组是因为恰巧信息的流动都是至右向左,所以可以覆盖掉d[j].但是如果换个思维,视j为背包的空余,那么方向就相反了,就不能用一位数组了。#include <iostream>#include <bits/stdc++.h>#define maxn 3450#define INF 0x3f3f3f3fu...

2019-05-16 09:50:54 81

原创 Piggy-Bank POJ - 1384

今夜是DP之夜~#include <iostream>#include <bits/stdc++.h>#define maxn 2010#define INF 0x3f3f3f3f#define ll long longusing namespace std;ll d[50010];//v,mint p[maxn],w[maxn];int main(...

2019-05-15 22:24:46 103

原创 Unidirectional TSP UVA - 116

这道题也成功AC~#include <iostream>#include <bits/stdc++.h>#define maxn 100+10#define INF 0x3f3f3f3fusing namespace std;int maze[maxn][maxn];int d[maxn][maxn];int row[3];int m,n;int ...

2019-05-15 20:40:23 61

原创 The Tower of Babylon UVA - 437

这也是一道DP。但是需要注意的是题目没有告诉我们高度和宽度的限制,所以矩阵会很稀疏,我们可以改用立方体的下标和长宽高的序号来表示。#include <iostream>#include <bits/stdc++.h>#define maxn 30+10using namespace std;int l[maxn][3];//长度int d[maxn][3...

2019-05-15 14:09:20 70

原创 UVA1025

这是一道DP题。感觉稍微有一点感悟,dp就像是一棵树的底层树叶,我们要做的就是往上开始堆。这道题有两个变量,一个是时间,一个是位置。边界就是t = T,s(站台) = n时,d[t][s] = 0;表示的是你需要在站台等待的时间,仅指你不在地铁上的时间。所以有三种状态:一种是你上一秒在站台上等,现在再等一秒钟;第二种是左边有车过来,所以等待的时间就是到下一个站台的等待时间(车上的时间不算)...

2019-05-15 13:41:00 332

原创 1590-硬币找零(coin)

DP问题Karter 是 Alfredo 镇的一家杂货店店主。由于商品物美价廉,Alfredo 镇的居民十分喜欢到 Karter 的杂货店去买东西。 随着杂货店的销量逐渐增加,一件事情逐渐开始困扰着 Karter,那就是:找零钱。 Alfredo 镇的硬币分为以下几种: • cent: 价值 1 分 • nickel: 价值 5 分 • dim...

2019-05-14 22:27:21 105

原创 NYOJ - 矩形嵌套(经典dp)

有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b<d或者b<c,a<d(相当于旋转X90度)。例如(1,5)可以嵌套在(6,2)内,但不能嵌套在(3,4)中。你的任务是选出尽可能多的矩形排成一行,使得除最后一个外,每一个矩形都可以嵌套在下一个矩形内。如果有多解,矩形编号的字典序应尽量小。#inclu...

2019-05-14 21:17:21 311

原创 Unique Snowflakes UVA - 11572

#include <iostream>#include <bits/stdc++.h>using namespace std;vector<int>a;set<int>S;int main(){ int T,n; int num; cin>>T; while(T--) { ...

2019-05-05 21:17:48 130

原创 Wine trading in Gergovia UVA - 11054

#include <iostream>#include <bits/stdc++.h>using namespace std;const int maxn = 1e5+10;int main(){ int n; int a[maxn]; while(cin>>n && n) { lon...

2019-05-05 16:28:51 131

原创 Fabled Rooks UVA - 11134

#include <iostream>#include <bits/stdc++.h>#define maxn 5000+10using namespace std;bool solve(int * a,int * b,int n,int * c){ fill(c+1,c+n+1,-1); for(int i = 1;i<=n;i++)...

2019-05-05 16:10:39 76

原创 Building for UN UVA - 1605

这道题真是神了。我真是没有想到可以这么写。#include <iostream>#include <bits/stdc++.h>using namespace std;int main(){ int n; int H = 2; char t; while(cin>>n) { cout<...

2019-05-04 22:58:47 88

原创 UVA(120)

#include <iostream>#include <bits/stdc++.h>using namespace std;vector<int>a;int main(){ string s; int num; while(getline(cin,s)) { cout<<s<&lt...

2019-05-04 22:27:55 353

原创 NYOJ 287 Rader

#include <iostream>#include <bits/stdc++.h>using namespace std;struct Node{ int a,b; Node(int i,int j):a(i),b(j){} bool operator < (const Node & c) const { ...

2019-05-04 16:34:14 111

原创 不相交区间数

#include <iostream>#include <bits/stdc++.h>using namespace std;struct Node{ int be; int ed; Node(int a,int b):be(a),ed(b) {} const bool operator < (const Node &amp...

2019-05-04 16:12:48 152

最短迷宫路径求解

这个是数据结构的最短迷宫求解路径,通过广义搜索求解.

2018-04-13

逆波兰的程序

数据结构的作业,逆波兰的程序,写了挺久的,希望大家喜欢.

2018-03-25

学生管理系统数据库

学生管理系统数据库,自己做的~.....................................................................................................................

2018-03-13

空空如也

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

TA关注的人

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