Editorial for Khoảng cách từ điểm đến đường thẳng


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Ta sẽ sử dụng công thức được định nghĩa trong SGK Hình học lớp 10 (bản cũ):

$$d(A, d) = \frac{|Ax + By+ C|}{\sqrt{A^2+B^2}}$$

image

Trích từ SGK Hình học lớp 10


Comments

Please read the guidelines before commenting.



  • 0
    MaiThanh1342  commented on July 15, 2024, 2:39 p.m. edited

    Vấn đề với sai số làm tròn 10^-6 (như thế này) giải quyết như sau:

    Hãy thêm vào setprecision(n) và fixed nữa. Khi đó kết quả sẽ được in ra chính xác cố định đến n chữ số thập phân

    cout << setprecision(6) << fixed << result;