摘要:
#include <iostream>using namespace std;#define MAX 10000int origin[101] = {0};typedef struct range_st { int l,r;} range_st, *range_t;int ranges_len = 0;range_st ranges[MAX];range_st temp[MAX];void union_range(range_st rg) { int i,j,union_count; for(i=0;i<ranges_len && ranges[i].r + 阅读全文
摘要:
int merge(int *p1, int l1, int *p2, int l2, int *p3) { int l3 = 0, i,j,k; for(i=0,j=0;i<l1 && j<l2;) { if(p1[i] < p2[j]) p3[l3++] = p1[i++]; else if(p1[i] > p2[j]) p3[l3++] = p2[j++]; else // equal i++; } while(i<l1) p3[l3++] = p1[i++]; while(j<l2) p3[l3++] = p2[j++]; retur 阅读全文