fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double s1, s2, n, x;
  7. cin >> n;
  8. x = n*(5-sqrt(3)-sqrt(6*sqrt(3)-4))/(8*(2-sqrt(3)));
  9. s1 = 4*x; //Длина пути по дороге
  10. s2 = sqrt(2*(n*n - 4*x*n + 8*x*x)); //Длина пути напрямик
  11. cout << s1 <<' ' << s2;
  12. return 0;
  13. }
Success #stdin #stdout 0s 3472KB
stdin
10
stdout
13.802 10.6984