// 活动选择问题(活动安排问题)(最大数目活动选择问题).cpp : Defines the entry point for the console application.
//贪心算法
#include "stdafx.h"
#include<iostream>
#define N 100
using namespace std;
struct Activity
{
int number; //活动编号
int begin; //活动开始时间
int end; //活动结束时间
bool flag; //此活动是否被选择
};
//对于活动集,按照结束时间递增排序,使用快速排序
void fast_sort(Activity *act,int f,int t)
{
if(f<t)
{
int i = f-1,j = f;
Activity a = act[t];
while(j<t)
{
if(act[j].end<=a.end)
{
i++;
Activity temp1 = act[i];
act[i] = act[j];
act[j] = temp1;
}
j++;
}
Activity temp2 = act[t];
act[t] = act[i+1];<