fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. ios_base::sync_with_stdio(false);
  9. cin.tie(NULL);
  10.  
  11. int x, y;
  12. cin >> x >> y;
  13. double a = sqrt(5 * 5 + 5 * 5 - 4), // Tính đoạn OA
  14. c = sqrt((x - 5) * (x - 5) + (y - 5) * (y - 5) - 4), // Tính đoạn BK
  15. u = ((0 - 5) * (x - 5) + (0 - 5) * (y - 5)) // cos(OIK)
  16. / (sqrt(5 * 5 + 5 * 5) * sqrt((x - 5) * (x - 5) + (y - 5) * (y - 5))),
  17. v = 2 / sqrt((0 - 5) * (0 - 5) + (0 - 5) * (0 - 5)), // cos(OIA)
  18. w = 2 / sqrt((x - 5) * (x - 5) + (y - 5) * (y - 5)); // cos(BIK)
  19. double phi = (acos(u) - acos(v) - acos(w)), // Tính góc phi = OIK - OIA - BIK
  20. b = phi * 2; // Tính cung AB
  21. double res = a + b + c; // OA + cung AB + BK
  22. cout << fixed << setprecision(2) << res;
  23. }
Success #stdin #stdout 0s 5252KB
stdin
Standard input is empty
stdout
nan