fork download
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. double*a = new double[n];
  10. for(int i = 0; i < n; ++i) cin >> a[i];
  11. sort(a,a+n);
  12. n = unique(a,a+n) - a;
  13. for(int i = 0; i < n; ++i) cout << a[i] << " ";
  14.  
  15. }
Success #stdin #stdout 0s 5548KB
stdin
10
0.1 0.5 0.3 0.7 0.1 0.2 0.3 0.0 0.7 0.2
stdout
0 0.1 0.2 0.3 0.5 0.7