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

1714 단어 bojboj

✅ 구현

문제

링크

풀이

#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;
        }
    }
}

좋은 웹페이지 즐겨찾기