自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 PAT1033 To Fill or Not to Fill

1033 To Fill or Not to Fill With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way fr...

2018-10-27 11:21:06 261

转载 PAT 1022 Digital Library(STL)

1022 Digital Library A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an u...

2018-10-17 15:52:25 180

原创 PAT 1020 Tree Traversals

1020 Tree Traversals (25 分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order t...

2018-10-16 20:48:33 190

原创 PAT 1017 Queueing at Bank

1017 Queueing at Bank (25 分) Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait...

2018-10-14 20:02:07 214

转载 PAT 1012 The Best Rank

参考自: https://www.nowcoder.com/questionTerminal/5a5281aef52a4f6f943929c05ba71c11 题目链接: 1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we consider their gra...

2018-10-12 16:25:27 178

原创 PAT1010 Radix

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. your task is to find the radix of ...

2018-10-11 20:53:38 150

转载 洛谷P4779 单源最短路径 堆优化+dijstra

题目描述: 给定一个NNN点,MMM条有向边的带非负权图,请你计算从SSS出发,到每个点的距离。 数据保证你能从SSS出发到任意点。 输入输出格式 输入格式: 第一行为三个正整数NNN,MMM,SSS, 第二行起MMM行,分别表示从uiu_iui​到viv_ivi​的权值为wiw_iwi​的边。 输出格式: 输出一行 NNN个空格分隔的非负整数,表示SSS到每个点的距离。 输入输出例子 输入 4...

2018-10-08 20:45:18 262

转载 洛谷P1441 砝码称重(加强版)

题目链接 P1441 砝码称重 解题思路: 搜索/枚举+dp dp过程参考弱化版的P2347 砝码称重。 妙啊,真的是妙啊… 感觉这题搜索和dp结合的恰到好处。利用dfs先枚举出所有可能的情况,当数组a[i]a[i]a[i]中被标记的数值达到mmm后,表示已经舍弃了mmm个值,在剩下的n−mn-mn−m个值里面dp就行了。 在dp过程,由于题目数据范围可知,所有砝码的和一定不超过2000,所以用一...

2018-10-06 21:22:52 754

转载 洛谷P1514 引水入城

题目链接 洛谷P1514 引水入城 解题思路: 综合考察了搜索和区间合并。 难点在于记录最后一行区间的左右端点,还有从第一行开始搜时,注意优化一下,并不是第一行的每列作为起点开始搜,而是比左右端点都大的列开始搜,可以节省时间。 区间合并注意排序。 include <iostream> #include<cstdio> #include<cstring> #inc...

2018-10-06 11:28:23 353

原创 洛谷P1378 油滴扩展

题目链接 P1378 油滴扩展 解题思路: #include <iostream> #include<cstdio> #include<cmath> #include<cstring> #define PI 3.1415926535 using namespace std; struct node{ int x,y; }a[10]; double...

2018-10-05 20:32:44 243

转载 洛谷P1120 小木棍 [数据加强版](剪枝技巧!)

题目链接 P1120 小木棍 [数据加强版] 参考自: https://www.luogu.org/blog/user30688/solution-p1120 解题思路: 这题关键在于剪枝。 (1)逆序排列整个序列,从最大的值往回搜 (2)dfs每次从当前点nownownow开始搜,而不是每次从最开始的点a[1]a[1]a[1]开始搜 (3)在正向的搜索过程中,如果当前积累的长度numnumnum...

2018-10-05 17:21:05 279

原创 洛谷 P1233 木棍加工

题目链接 P1233 木棍加工 解题思路: 其实就是求最长上升子序列(参见diworth定理,序列的不下降子序列最少划分数等于上升序列的总长度) 首先需要做的是先将序列排序(这里采取的是先将序列的l值升序,再将序列的w值升序) 在求解最长上升子序列时,保证在j<ij<ij<i时,a[i].l>a[j].l&&a[i...

2018-10-03 21:24:20 740

原创 洛谷P1387 最大正方形

题目链接 P1387 最大正方形 思路1: 前缀和+暴力,注意只有一个点时,边长记为1,而不是0. #include <iostream> #include<cstdio> using namespace std; int f[110][110],a[110][110]; int main(int argc, char** argv) { int n,m; scanf(...

2018-10-01 23:34:33 275

转载 洛谷P1006 传纸条

题目链接 P1006 传纸条 解题思路: 多维动态规划(不是两个起点的dfs),可以看做从相同地点到相同终点的两条不相交的路径。注意到两个人传的纸条经历的总路径相等。设f[i][j][k][l]f[i][j][k][l]f[i][j][k][l]为两人从同一起点传的路径到达(i,j)(i,j)(i,j)和(k,l)(k,l)(k,l)的总的值。有i+j=k+li+j=k+li+j=k+l成立,当i...

2018-10-01 17:23:49 182

空空如也

空空如也

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

TA关注的人

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