序列
有一个整数序列,它的每个数各不相同,我们不知道它的长度是多少(即整数个数),但我们知道在某些区间中间至少有多少个整数,用 (Li,Ri,Ci) 来描述,表示这个整数序列中至少有 Ci个数来自区间 [Li,Ri],给出若干个这样的区间,问这个整数序列的长度最少能为多少?
输入格式
第一行一个整数 N(1≤N≤1000),表示区间个数;接下来 N 行,每行三个整数,描述一个区间和区间内数至少有 Ci 个。
输出格式
一个数,表示该整数序列的最小长度。
Sample Input
4
4 5 1
6 10 3
7 10 3
5 6 1
Sample Output
4
贪心题
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std ;
const int N = 1005 ;
struct node
{
int l , r , c ;
}a[N] ;
bool b[N