A1089/B1035——Insert Merge插入与归并(测试点5、6)

坑点:
①归并排序时要考虑最后一组数量不足2i的情况,例如4个一组时最后只剩3个也要排序
②测试点迭代(当第i次排序与第i+1次得到序列相同时,这个时候默认为第i次排序)

#include
#include
using namespace std;
const int maxn=105;
int start[maxn],endd[maxn],Insert[maxn],Merge[maxn];
int n;
void In(int i){         //i表示第i次进行排序,first i=1;
    sort(Insert,Insert+i+1);
}

void Me(int i){
    int j;
    for(j=0;j

 

你可能感兴趣的:(PAT刷题)