Saturday 26 March 2016

Solution of LIGHT OJ 1053 :: Higher Math


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main()
{
    long long int a,b,c,d,e,f,g,h;
    scanf("%lld", &d);
    for(e=1; e<=d; e++)
    {
        scanf("%lld%lld%lld", &a, &b, &c);
        if(a>b && a>c)
        {
            f=a*a;
            g=b*b+c*c;
        }
        else if(b>a && b>c)
        {
            f=b*b;
            g=a*a+c*c;
        }
        else if(c>a && c>b)
        {
            f=c*c;
            g=a*a+b*b;
        }
        if(f==g)
            printf("Case %d: yes\n",e);
        else
            printf("Case %d: no\n",e);
    }
    return 0;
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.