標題:
APCS-三角形辨別
[打印本頁]
作者:
李知易
時間:
2025-1-18 13:11
標題:
APCS-三角形辨別
[attach]20483[/attach]
作者:
洪承廷
時間:
2025-1-25 09:08
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[3];
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
for(int i=0;i<3;i++)
{
if(i==0)
cout<<a[i];
else
cout<<" "<<a[i];
}
cout<<endl;
if(a[0]+a[1]<=a[2])
cout<<"No"<<endl;
else if(pow(a[0],2)+pow(a[1],2)==pow(a[2],2))
cout<<"Right";
else if(pow(a[0],2)+pow(a[1],2)>pow(a[2],2))
cout<<"Acute";
else if(pow(a[0],2)+pow(a[1],2)<pow(a[2],2))
cout<<"Obtuse";
return 0;
}
複製代碼
作者:
高鋐鈞
時間:
2025-1-25 09:36
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[3];
for(int i=0;i<3;i++){
cin>>a[i];
}
sort(a,a+3);
for(int i=0;i<3;i++){
cout<<a[i]<<" ";
}
cout<<endl;
if(a[0]+a[1]<=a[2]){
cout<<"No";
}else{
if(pow(a[0],2)+pow(a[1],2)>pow(a[2],2)){
cout<<"Acute";
}else if(pow(a[0],2)+pow(a[1],2)==pow(a[2],2)){
cout<<"Right";
}else{
cout<<"Obtuse";
}
}
return 0;
}
複製代碼
作者:
高昀昊
時間:
2025-2-7 20:58
#include<bits/stdc++.h>
using namespace std;
int main()
{
cin.sync_with_stdio(0);
cout.sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long a,b,c,x,y,z;
cin>>x>>y>>z;
a=min(min(x,y),z);
c=max(max(x,y),z);
b=min(min(max(x,y),max(x,z)),max(y,z));
cout<<a<<" "<<b<<" "<<c<<"\n";
if(a+b<=c){
cout<<"No";
}else{
if(a*a+b*b==c*c){
cout<<"Right";
}else if(a*a+b*b>c*c){
cout<<"Acute";
}else if(a*a+b*b<c*c){
cout<<"Obtuse";
}
}
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2