#38254: C++程式


yp11251200@yphs.tp.edu.tw (701-26徐立權)

學校 : 臺北市私立延平高級中學
編號 : 239171
來源 : [203.72.178.1]
最後登入時間 :
2024-05-02 17:14:52
d980. 11479 - Is this the easiest problem? -- UVa11479 | From: [203.72.178.1] | 發表日期 : 2023-11-07 17:30

#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv)
{
long long int t,a,b,c;
while(cin>>t)
{
for(int i=1; i<=t; i++)
{
a=0;b=0;c=0;
cin>>a>>b>>c;

if(a<=0 || b<=0 || c<=0 ) //side won't be 0 or -
{
// Case 1: Invalid
cout<<"Case "<<i<<": Invalid"<<endl;
}else if((a+b>c ) &&( a-b<c) )//triangle
{
if((a==b) && (b==c)) //正三角形
{
cout<<"Case "<<i<<": Equilateral"<<endl;

}else if((a==b) && (b!=c)) //等腰
{
cout<<"Case "<<i<<": Isosceles"<<endl;
} else
{
cout<<"Case "<<i<<": Scalene"<<endl;
}


}else
{
cout<<"Case "<<i<<": Invalid"<<endl;
}






}


}
//return 0;
}

 
ZeroJudge Forum