随笔 - 530
文章 - 0
评论 - 3
阅读 -
10098
随笔分类 - 贪心
1~n 线段覆盖
摘要:void solve(){ int r=a[1].r; int i=2, mx=0, ans=1; while(r<len){ mx=r; while(a[i].l<=r&&i<=len){ mx=max(mx,a[i].r); i++; } ans++ ; r=mx; } cout<<ans-1<
阅读全文
一本通1424: 区间覆盖
摘要:给一些区间,挑出最少的区间覆盖 【0,L】 贪心:从0往后,每次挑出R 点最大的 #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std ; const int
阅读全文
cf1731A
摘要:题目 略 简单的贪心 #include <iostream> #include <cstring> using namespace std; const int N=2003; int n,k,len; int c[30]; char s[N]; int main(){ int cas; cin>>
阅读全文