Advertisement
Zuneve

first cpp

Aug 27th, 2022
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <cmath>
  4. #include <iomanip>
  5. using namespace std;
  6. int main() {
  7.     int n;
  8.     cin >> n;
  9.     set <double> z;
  10.     int a[50][2];
  11.     for (int i = 0; i<n; i++) {
  12.         for (int j = 0; j<2; j++) {
  13.             cin >> a[i][j];
  14.         }
  15.     }
  16.     for (int i = 0; i<n; i++) {
  17.         for (int j = 0; j<n; j++) {
  18.             if (i!=j) {
  19.                 z.insert(sqrt(pow(a[i][0]-a[j][0],2)+pow(a[i][1]-a[j][1],2)));
  20.             }
  21.         }
  22.     }
  23.     cout << z.size() << endl;
  24.     for (auto s : z) {
  25.         cout << setprecision(1000)  << s << endl;
  26.     }
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement