fork download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. long long r, x0, y0, x1, y1;
  8. cin>>r>>x0>>y0>>x1>>y1;
  9. long long d = (x1-x0)*(x1-x0) + (y1-y0)*(y1-y0);
  10. double k=sqrt(d);
  11.  
  12. if (x1==x0 && y1==y0)
  13. {
  14. cout<<"0";
  15. }
  16. else
  17. {
  18. if ((k/2)<=r)
  19. cout<<"1";
  20. else
  21. {
  22. long long dem=0;
  23. do
  24. {
  25. k=k-(double)(r*2);
  26. dem++;
  27. }
  28. while (k/2>r);
  29.  
  30. cout<<dem+1;
  31. }
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0s 15232KB
stdin
2 0 0 4 0
stdout
1