Ad

Thursday, March 21, 2013

Uva 11479 - Is this the easiest problem ?, programing from Uva

Problem ID - 11479,
Problem Name - Is this the easiest problem ?




#include <stdio.h>

int main()
{
    signed long int a, b, c;
    int test_case, i;


    while(scanf("%d", &test_case)==1)
    {
        if(test_case>0 && test_case<20)
        {
            for(i=1; i<=test_case; i++)
            {
                scanf("%ld %ld %ld", &a, &b, &c);
                if( a+b>c && b+c>a && c+a>b)
                {
                    if(a==b && b==c && c==a)
                    {
                        printf("Case %d: Equilateral\n", i);
                    }
                    else if (a!=b && b!=c && c!=a)
                        printf("Case %d: Scalene\n", i);

                    else if(a==b || b==c || c==a)
                        printf("Case %d: Isosceles\n", i);
                }
                else
                {
                    printf("Case %d: Invalid\n", i);
                }
            }
        }
    }
    return 0;

}

0 comments:

Post a Comment