摘要: 分析:先按照w+s排序,从前到后遍历即可 #include <bits/stdc++.h> using namespace std; const int N = 50050; typedef pair<int,int> PII; PII f[N]; int n; int main() { scanf 阅读全文
posted @ 2020-08-26 22:00 Sexyomaru 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 分析:先按区间左端点进行排序,然后遍历区间,找一个区间左右端点覆盖起始点,右端点尽量远,直到可以覆盖目标区间右端点 #include <bits/stdc++.h> using namespace std; const int N = 100010; struct Edge{int a, b;} e 阅读全文
posted @ 2020-08-26 15:23 Sexyomaru 阅读(120) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean judgePoint24(int[] nums) { double[] a = new double[]{nums[0],nums[1],nums[2],nums[3]}; return find(a); } public boolea 阅读全文
posted @ 2020-08-26 15:05 Sexyomaru 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 分析:先将区间按左端点排序,然后建一个小堆存放以有组的右端点,然后遍历区间,当堆为空或堆中最小的右端点都大于当前区间的左端点, 则当前区间另分一组,否则就将当前区间划分给堆中最小左端点的那个区间,并更新这个区间的右端点,最后返回堆的大小 #include <bits/stdc++.h> using 阅读全文
posted @ 2020-08-26 11:09 Sexyomaru 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 分析:先按区间的右端点排序,然后从左到右遍历,当前区间左端点小于上一区间的右端点,总个数不变,否则总个数加一,并更新右端点 #include <bits/stdc++.h> using namespace std; const int N = 100010; struct Edge{int a, b 阅读全文
posted @ 2020-08-26 10:26 Sexyomaru 阅读(77) 评论(0) 推荐(0) 编辑