畫出一個長方形,內部隨機找一個點P ,將此長方形依照 p 點的位置分成 4 塊對角線依序為 PA PB PC PD 的長方形
透過畢氏定理不難發現,PA^2 + PC^2 = PB^2 + PD^2
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
long long int a, b, c;
while(cin >> a >> b >> c)
cout << fixed << setprecision(2) << sqrt(a*a + c*c - b*b) << endl;
}
文章標籤
全站熱搜

Thank you ! I extremely like your answer. It really help me a lot. However, I still have a question, " What is the conclusion in this answer?" If you reply me, I'll be very happy. Have a good day.
I added a graph in the article. Hopefully, it can give you some ideas. Thank you for your support ^^