[boj] (b3) 4153 직각삼각형

강신현·2022년 4월 1일
0

✅ 구현

문제

링크

풀이

#include <cmath>
pow(a, 2)

코드

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int a, b, c;

    while (1)
    {
        cin >> a >> b >> c;
        if (a == 0 && b == 0 && c == 0)
            break;

        int M = max(a, max(b, c));

        if (M == a)
        {
            if (pow(a, 2) == (pow(b, 2) + pow(c, 2)))
                cout << "right" << endl;
            else
                cout << "wrong" << endl;
        }
        else if (M == b)
        {
            if (pow(b, 2) == (pow(a, 2) + pow(c, 2)))
                cout << "right" << endl;
            else
                cout << "wrong" << endl;
        }
        else
        {
            if (pow(c, 2) == (pow(b, 2) + pow(a, 2)))
                cout << "right" << endl;
            else
                cout << "wrong" << endl;
        }
    }
}
profile
땅콩의 모험 (server)

0개의 댓글