Friday, March 18, 2016

UVA 11479 - Is this the easiest problem?

#include<bits/stdc++.h>
#define i64 long long
#define mx(a,b,c) max(a,max(b,c))
#define mn(a,b,c) min(a,min(b,c))
#define eef else if
#define ff(i,s,e) for(int i=(s); i<e; i++)
#define ff2(i,s,e) for(int i=(s); i>=e; i--)
#define sf scanf
#define pf printf
#define dbug(x) cout<<"x = "<<x<<endl
using namespace std;
bool isValid(long a,long b,long c){
    if(a + b <= c)
        return false;
    if(b + c <= a)
        return false;
    if(a + c <= b)
        return false;
    return true;
}

int main()
{
    int cse=0,cnt=0,flg=0;
   long a,b,c,test;
    cin >> test;
    for(int i = 1; i <= test; i++){
        cin >> a >> b >> c;
        if(!isValid(a,b,c)){
            cout << "Case " << i << ": Invalid\n";
            continue;
        }
        if(a == b && b == c)
            cout << "Case " << i << ": Equilateral\n";
        else if(a == b || b == c || a == c)
            cout << "Case " << i << ": Isosceles\n";
        else if(a != b && b != c && c != a) cout << "Case " << i << ": Scalene\n";
    }
    return 0;

}

No comments:

Post a Comment