#include <IOSTREAM> #include<VECTOR> using namespace std; void recursive(int s[],int f[],int i,int n,vector<int> &h) { int m=i+1; while (m<=n&&s[m]<f[i]) { m=m+1; } if (m<=n) { h.push_back(m); // h.insert(h.end(),m); recursive(s,f,m,n,h); } } int main() { int s[12]={0,1,3,0,5,3,5,6,8,8,2,12}; int f[12]={0,4,5,6,7,8,9,10,11,12,13,14}; vector<int> h;//h为存放活动的向量 recursive(s,f,0,11,h); vector<int>::iterator t; for (t=h.begin();t!=h.end();t++) { if (t!=h.end()-1) { cout<<*t<<" "; } else { cout<<*t<<endl; } } return 0; }
04-01
461

12-09
8237

06-06
497
