SWUST OJ(1102)

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

 1 #include 
 2 #include 
 3 using namespace std;
 4 
 5 int main()
 6 {
 7     int *data, n;
 8     cin>>n;
 9 
10     data = (int*)malloc(n*sizeof(int));
11 
12     for (int i = 0; i < n; ++i)
13     {
14         cin>>data[i];
15     }
16 
17     for (int i = n-1; i >= 0; --i)
18     {
19         if (data[i] <= data[0])
20         {
21             cout<" ";
22         }
23     }
24 
25     for (int i = 0; i < n; ++i)
26     {
27         if (data[i]>data[0])
28         {
29             cout<" ";
30         }
31     }
32     return 0;
33 }

 

转载于:https://www.cnblogs.com/Ghost4C-QH/p/10678439.html

你可能感兴趣的:(SWUST OJ(1102))