Advertisement
STANAANDREY

pb 43

Sep 17th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n, v[1000];
  7.     cin >> n;
  8.     for (int i = 0; i < n;i++)
  9.     {
  10.         int x;
  11.         cin >> x;
  12.         while (x > 9)
  13.             x /= 10;
  14.         v[i] = x;
  15.     }
  16.  
  17.     for (int i = 0; i < n - 1; i++)
  18.         for (int j = i + 1; j < n; j++)
  19.         if (v[i] > v[j])
  20.     {
  21.         int aux = v[i];
  22.         v[i] = v[j];
  23.         v[j] = aux;
  24.     }
  25.     for (int i = 0; i < n; i++)
  26.         cout << v[i];
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement