上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页
摘要: 地址:http://codeforces.com/problemset/problem/455/A Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winte 阅读全文
posted @ 2020-04-11 23:35 liyexin 阅读(178) 评论(0) 推荐(0)
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1176 中文题意不多解释了。 建一个二维dp数组,dp[ i ][ j ]表示第 i 秒落在 j 处一个馅饼。我们需要倒着DP,为什么呢,从 0秒,x=5处出发,假如沿数组正着往下走,终点到哪里我们是不知道的 阅读全文
posted @ 2020-04-11 23:34 liyexin 阅读(133) 评论(0) 推荐(0)
摘要: 之前就已经学过了,放在了本地,现在搬到博客园来~ 关于线段树的视频学习,强烈推荐B站此大佬的讲解:https://www.bilibili.com/video/BV1cb411t7AM 1.概念:线段树是一种二叉搜索树,与区间树相似。线段树是建立在线段或区间基础上的树,树的每个结点代表一条线段[L, 阅读全文
posted @ 2020-04-11 23:17 liyexin 阅读(141) 评论(0) 推荐(0)
摘要: 地址:http://codeup.cn/problem.php?id=5974 题目描述 已知 n 个整数b1,b2,…,bn 以及一个整数 k(k<n)。 从 n 个整数中任选 k 个整数相加,可分别得到一系列的和。 例如当 n=4,k=3,4 个整数分别为 3,7,12,19 时,可得全部的组合 阅读全文
posted @ 2020-04-11 16:51 liyexin 阅读(321) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstring> using namespace std; const int maxn=1e3; int vis[maxn]; int p[maxn]; int n; int t=0; void dfs(int x) { if(x==n+1) 阅读全文
posted @ 2020-04-11 16:49 liyexin 阅读(136) 评论(0) 推荐(0)
摘要: 和ACWING 844基本一样。但是这里要输出路径 我的做法是,pair一个ing[x][y],ing[x][y].first,ing[x][y].second记录x,y的前一个点。因为是逆序,所以又存进一个结构体里,再逆序输出,才变成正序了。 #include<iostream> #include 阅读全文
posted @ 2020-04-11 16:48 liyexin 阅读(131) 评论(0) 推荐(0)
摘要: 地址:https://www.acwing.com/problem/content/846/ 走迷宫,从左上角走到右下角,0可走,1不可走,问最少需要几步。 BFS解法: 通过g[][]记录地图,d[][]初始化为-1用来保证一个点只能走一次以及记录每个点到达终点的距离。 注意:使用以下语句来实现队 阅读全文
posted @ 2020-04-11 16:46 liyexin 阅读(251) 评论(0) 推荐(1)
摘要: ACWING板子题地址:https://www.acwing.com/problem/content/description/845/ 题中已经说的很清楚了,什么叫n皇后。对于一个棋子的摆放,我们应该保证这个棋子所在位置的一列,斜方向和反斜方向没有棋子。怎么判断呢,我们引入bool类型的row[]数 阅读全文
posted @ 2020-04-11 16:45 liyexin 阅读(563) 评论(1) 推荐(1)
摘要: 地址:http://codeforces.com/contest/1333 题意:满足条件:某块四周至少一个与它不同颜色。要求满足此条件的块数B=W+1。输出任意答案。 解析:想多了自己。其实只要把左上角染成W,其他全B就行了,W=1,B=2,满足条件。 #include<iostream> #in 阅读全文
posted @ 2020-04-10 20:41 liyexin 阅读(197) 评论(0) 推荐(0)
摘要: Problem Description Benny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes 阅读全文
posted @ 2020-04-08 18:22 liyexin 阅读(194) 评论(0) 推荐(0)
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 32 下一页