void mergeSort(int q[],int l,int r)
{
//划分区间
if(l>=r) return ;
int mid = l + r >> 1;
//组内排序
mergeSort(q, l , mid);
mergeSort(q, mid+1 , r);
//合并
int k = 0 , i = l, j = mid+1;
while(i <= mid && j <= r)
{
if (q[i] <= q[j]) temp[k++] = q[i++];
else temp[k++] = q[j++];
}
while (i <= mid) temp[k++] = q[i++];
while (j <= r) temp[k++] = q[j++];
for(i = l, k = 0; i <= r; i++, k++)
q[l] = temp[k];
}