Loading

摘要: 题目链接: https://www.acwing.com/problem/content/description/1214/ 题解: DP问题混合怪兽 AC代码: #include <cstring> #include <iostream> #include <algorithm> #include 阅读全文
posted @ 2020-02-10 14:53 Doubest 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/897/ 题解: 一维DP问题,非常经典 AC代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> 阅读全文
posted @ 2020-02-09 16:50 Doubest 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/2/ 题解: 关于DP问题,我们一般可以用一套模式去分析 1、分析状态表示f(i,j): 1)f(i,j)表示哪个集合?在01背包问题中,它表示选法的一个集合 2)i,j表示什么条件?在01背包问题中,它表示前 阅读全文
posted @ 2020-02-09 11:08 Doubest 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/101/ 题解: 边界问题最复杂,画图好好模拟一下,二维前缀和还是比较容易的 枚举的所有的边长为R的正方形,AC代码是枚举的正方形的左上端点。 AC代码: #include <cstdio> #include 阅读全文
posted @ 2020-02-08 13:07 Doubest 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/1232/ 题解: 这个公式最重要s[r] - s[l-1] % k == 0 等价于 s[r]%k == s[l-1] % k 意思就是说,只要s[n]和s[m]模k的值一样,他们必然可以组成一个k倍区间 边 阅读全文
posted @ 2020-02-07 19:06 Doubest 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/798/ 代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N = 100 阅读全文
posted @ 2020-02-07 14:24 Doubest 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 问题描述: Ubuntu系统运行没有问题,一个大问题就是鼠标不灵,失控,但是鼠标又没有问题 解决办法: 关闭桌面日历! 阅读全文
posted @ 2020-02-06 19:14 Doubest 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.acwing.com/problem/content/732/ 题解: 这个题最重要的一点就是:用初始值丈量能不能行时,一定要及时停止,不然连long long都给你爆了。 二分的两个边界: l = (min + 1) / 2 r = max 原因是: x + x 阅读全文
posted @ 2020-02-06 13:55 Doubest 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 给定一个按照升序排列的长度为n的整数数组,以及 q 个查询。 对于每个查询,返回一个元素k的起始位置和终止位置(位置从0开始计数)。 如果数组中不存在该元素,则返回“-1 -1”。 输入格式 第一行包含整数n和q,表示数组长度和询问个数。 第二行包含n个整数(均在1~10000范围内),表示完整数组 阅读全文
posted @ 2020-02-06 11:35 Doubest 阅读(107) 评论(0) 推荐(0) 编辑
摘要: Description Input Output 当时做题时,思路没问题,但是有一个很大的问题就是自己在编程时没化简表达式,n*m 爆了 int,还有一个点就是,向上去整没用好! #include <bits/stdc++.h> using namespace std; int main() { d 阅读全文
posted @ 2019-12-15 20:55 Doubest 阅读(96) 评论(0) 推荐(0) 编辑