#45424: C++ if硬解


11210831@std.tcfsh.tc.edu.tw (陳韋溱臺中一中)

學校 : 不指定學校
編號 : 300872
來源 : [223.141.244.243]
最後登入時間 :
2025-04-21 13:20:10
d507. 三角形的判斷 -- 板橋高中教學題 | From: [111.82.208.114] | 發表日期 : 2025-03-01 00:14

#include<bits/stdc++.h>
using namespace std;

int main(){
int A, B , C;
cin >> A >> B >> C;
if(A>=B && A>=C && pow(B,2)+pow(C,2)>pow(A,2)){
cout << "acute triangle" <<endl;
}
else if(A>=B && A>=C && pow(B,2)+pow(C,2)==pow(A,2)){
cout << "right triangle" <<endl;
}
else if(A>=B && A>=C && pow(B,2)+pow(C,2)<pow(A,2)){
cout << "obtuse triangle" <<endl;
}
else if(B>=A && B>=C && pow(A,2)+pow(C,2)>pow(B,2)){
cout << "acute triangle" <<endl;
}
else if(B>=A && B>=C && pow(A,2)+pow(C,2)==pow(B,2)){
cout << "right triangle" <<endl;
}
else if(B>=A && B>=C && pow(A,2)+pow(C,2)<pow(B,2)){
cout << "obtuse triangle" <<endl;
}
else if(C>=B && C>=A && pow(B,2)+pow(A,2)>pow(C,2)){
cout << "acute triangle" <<endl;
}
else if(C>=B && C>=A && pow(B,2)+pow(A,2)==pow(C,2)){
cout << "right triangle" <<endl;
}
else{
cout << "obtuse triangle" <<endl;
}

return 0;
}

 
ZeroJudge Forum