fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. #define ll long long
  5. #define ld long double
  6. struct pt {
  7. ld x, y;
  8. void take() {
  9. int xx,yy;
  10. cin>>xx>>yy;
  11. x=xx,y=yy;
  12.  
  13. }
  14. };
  15.  
  16.  
  17. const ld EPS = 1e-6;
  18.  
  19. ld dist(pt p1, pt p2) {
  20. return sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) *(p2.y - p1. y));
  21. }
  22.  
  23. bool check_inside(pt p, ld r, pt center) {
  24. ld d = dist(p, center);
  25. if (d < r)
  26. return true;
  27. return (abs(dist(p, center) - r) <= EPS);
  28. }
  29. ld crossProduct(pt p1,pt p2,pt p3){
  30. return (p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x);
  31. }
  32. void solve() {
  33. int d; cin >>d;
  34. ld r = d * .5;
  35. pt p1, p2;
  36. p1.take();
  37. p2.take();
  38. // if (p1.x == p2.x) {
  39. // cout << 0;
  40. // return;
  41. // }
  42. pt center = {r, r};
  43. if (!check_inside(p1, r, center) ||!check_inside(p2, r, center)) {
  44. cout << 0;
  45. return;
  46. }
  47.  
  48. const ld PI = acos(-1);
  49. ld c = dist(p1, p2);
  50. ld a = dist(p1,center );
  51. ld b = dist(p2, center );
  52. ld co = a *a + b *b - c *c;
  53. ld den = 2 * a *b;
  54. co /= den;
  55. ld angle = acos(co);
  56. angle *= 180;
  57. angle /= (ld)PI;
  58. ld walk = angle / (ld)360;
  59. walk *= 60;
  60. ld speed = 33 +( ld)1 / 3.0;
  61. walk /= speed;
  62. ld cross=crossProduct(center,p1,p2);
  63. if(cross>0){
  64.  
  65. walk *= -1;
  66. }
  67. cout << setprecision(10) << fixed;
  68. cout <<walk << endl;
  69. }
  70.  
  71. signed main() {
  72. ios_base::sync_with_stdio(false);
  73. cin.tie(NULL);
  74. cout.tie(NULL);
  75.  
  76. int t = 1;
  77. // cin >> t;
  78. while (t--) {
  79. solve();
  80. }
  81.  
  82. return 0;
  83. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty