1 #include <iostream> 2 using namespace std; 3 int a[500]; 4 5 void qsort(int l, int r) { 6 int i, j, mid, p; 7 i = l; j = r; 8 mid = a[(l+r)/2]; 9 do { 10 while (a[i]<mid) i++; 11 while (a[j]>mid) j--; 12 if (i<=j) { 13 p = a[i]; a[i] = a[j]; a[j] = p; 14 i++; j--; 15 } 16 } while (i<=j); 17 if (l<j) qsort(l, j); 18 if (i<r) qsort(i, r); 19 } 20 21 int main() { 22 int n, t, k=0; 23 cin >> n; 24 for (int i=0; i<n; i++) { 25 cin >> t; 26 if (t%2==1) a[k++] = t; 27 } 28 qsort(0, k-1); 29 for (int i=0; i<k-1; i++) 30 cout << a[i] << ","; 31 cout << a[k-1] << endl; 32 return 0; 33 }