Editorial for Diện tích hình vuô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.

Author: admin

Gọi độ dài đường chéo là ~d~, độ dài cạnh là ~a~.

Khi đó ta có ~ d^2 = a^2 + a^2 ~ => ~d^2 = 2a^2~ (theo định lý Pytago)

Dễ thấy diện tích hình vuông là ~a^2 = d^2/2~.


Comments

Please read the guidelines before commenting.



  • 0
    khiemkrkt  commented on Sept. 26, 2023, 4:09 p.m.

    Lí do python sai test 4

    Python sau khi bình phương d lên thì xuất hiện sai số tại số tận cùng (lỗi floating point arithmetic chắc v)

    Cách 1

    Sử dụng hàm Demical() từ thư viện demical

    Cách 2

    Kiểm tra số cuối có phải số lẻ


  • 0
    dtdungvnt  commented on Sept. 17, 2023, 3:15 p.m.

    Tôi dùng python 3. Test 4 bị lỗi miết, không hiểu sao, team coi lại xem!