LightOJ 1053 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long double a, b, c, d;
    int t, i = 1;
    cin >> t;
    while(t--)
    {
        cin >> a >> b >> c;
        int f = 0;
        d = sqrt((a*a)+(b*b));
        if(d == c)
        {
            cout << "Case " << i++ << ": " << "yes" << "\n";
            f = 1;
            continue;
        }
        d = sqrt((b*b) + (c*c));
        if(d == a)
        {
            cout << "Case " << i++ << ": " << "yes" << "\n";
            f = 1;
            continue;
        }
        d = sqrt((c*c) + (a*a));
        if(d == b)
        {
            cout << "Case " << i++ << ": " << "yes" << "\n";
            f = 1;
            continue;
        }
        if(f == 0)
        {
            cout << "Case " << i++ << ": " << "no" << "\n";
        }
    }
    return 0;
}

Comments