杭电 hdu 3817

Triangle:

#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    cin.ignore();
    int count=1;
    while(n--){
        int a,b,c;
        cin>>a>>b>>c;
          
        int temp;
        if(a>b){
            temp=a;
            a=b;
            b=temp;
        }
        if(a>c){
            temp=a;
            a=c;
            c=temp;
        }
        if(b>c){
            temp=b;
            b=c;
            c=temp;
        }
          
        if(a*a+b*b==c*c)
            cout<<"Case "<<count<<": Right triangle"<<endl;
        else{
            if(a*a+b*b>c*c)
                cout<<"Case "<<count<<": Acute triangle"<<endl;
            else
                cout<<"Case "<<count<<": Obtuse triangle"<<endl;
        }
        count++;
    }
    return 0;
}


你可能感兴趣的:(ACM,HDU,杭电,3817)