# Include
Struct Object {int ObjectId; int ObjectStart; int ObjectFinish;} obj [11]; void Sort (Object obj [], int n) {int j; Object temp; int I; for (I = 0; I
Obj [j + 1]. objectFinish) {temp = obj [j]; obj [j] = obj [j + 1]; obj [j + 1] = temp ;}}}} int GreedySelector (Object obj [], int n) {bool a [11]; a [0] = true; int j = 0; int count = 1; for (int I = 1; I
= Obj [j]. objectFinish) {a [I] = true; j = I; count ++;} else {a [I] = false ;}} return count ;} void main () {struct Object obj [11]; obj [0]. objectId = 1; obj [0]. objectStart = 1; obj [0]. objectFinish = 4; obj [1]. objectId = 2; obj [1]. objectStart = 3; obj [1]. objectFinish = 5; obj [2]. objectId = 3; obj [2]. objectStart = 0; obj [2]. objectFinish = 6; obj [3]. objectId = 4; obj [3]. objectStart = 5; obj [3]. objectFinish = 7; obj [4]. objectId = 5; obj [4]. objectStart = 3; obj [4]. objectFinish = 8; obj [5]. objectId = 6; obj [5]. objectStart = 5; obj [5]. objectFinish = 9; obj [6]. objectId = 7; obj [6]. objectStart = 6; obj [6]. objectFinish = 10; obj [7]. objectId = 8; obj [7]. objectStart = 8; obj [7]. objectFinish = 11; obj [8]. objectId = 9; obj [8]. objectStart = 8; obj [8]. objectFinish = 12; obj [9]. objectId = 10; obj [9]. objectStart = 2; obj [9]. objectFinish = 13; obj [10]. objectId = 11; obj [10]. objectStart = 12; obj [10]. objectFinish = 14; Sort (obj, 11); int sum = GreedySelector (obj, 11); printf ("up to % d events \ t", sum );} 2 # include
# Define Max 100 typedef struct {int start; int finish; int number;} arrange; arrange plans [Max]; bool a [Max]; void interchange (arrange * m, arrange * n) {arrange temp = * m; * m = * n; * n = temp;} int partition (arrange array [], int p, int q) {int I, j; I = p; j = q + 1; while (1) {do I ++; while (array [I]. finisharray [p]. finish) & (j! = P); if (I
= P [j]. finish) {a [I] = true; j = I; count ++;} else a [I] = false;} return count;} void main () {int n, i; cout <"please input the number of arrange:" <
> N; for (I = 0; I
> Plans [I]. start> plans [I]. finish; plans [I]. number = I + 1;} quicksort (plans, 0, n-1); cout <"available together" <