Advertisement
Guest User

Untitled

a guest
Mar 1st, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. const int N=105;
  4.  
  5. typedef long double ld;
  6. typedef long long ll;
  7.  
  8. using namespace std;
  9.  
  10. ll n, r[N], cx[N], cy[N];
  11. int toremove[N];
  12.  
  13. ld dist(int a, int b) {
  14.     return (ld)sqrt((ld)((cx[a] - cx[b]) * (cx[a] - cx[b]) + (cy[a] - cy[b]) * (cy[a] - cy[b])));
  15. }
  16.  
  17. int main()
  18. {
  19.     cin >> n;
  20.     for(int i = 0; i < n; i++)
  21.         cin >> r[i] >> cx[i] >> cy[i];
  22.     for(int i = 0; i < n; i++)
  23.     {
  24.         for(int j = 0; j < n; j++)
  25.         {
  26.             if(i == j)
  27.                 continue;
  28.             if(dist(i, j) + (ld)r[j] <= (ld)r[i])
  29.                 toremove[i] = 1;
  30.         }
  31.     }
  32.     int ans = 0;
  33.     for(int i = 0; i < n; i++)
  34.     {
  35.         ans += toremove[i];
  36.         toremove[i] = 0;
  37.     }
  38.     cout << n - ans << "\n";
  39.     return 0;
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement