SWUST OJ(1102)

时间:2024-06-05 10:34:14

顺序表上数据的划分问题的实现

 #include <iostream>
#include <cstdlib>
using namespace std; int main()
{
int *data, n;
cin>>n; data = (int*)malloc(n*sizeof(int)); for (int i = ; i < n; ++i)
{
cin>>data[i];
} for (int i = n-; i >= ; --i)
{
if (data[i] <= data[])
{
cout<<data[i]<<" ";
}
} for (int i = ; i < n; ++i)
{
if (data[i]>data[])
{
cout<<data[i]<<" ";
}
}
return ;
}