본문 바로가기

Programming/BaekJoon

[C++] 백준 4153번 : 직각삼각형


https://www.acmicpc.net/problem/4153




#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;


int main() {


vector<int> v;

int tmp[3];

do {

cin >> tmp[0] >> tmp[1] >> tmp[2];

if ((tmp[0] != 0) || (tmp[1] != 0) || (tmp[2] != 0)) {

sort(tmp, tmp + 3);

if (tmp[0] * tmp[0] + tmp[1] * tmp[1] == tmp[2] * tmp[2])

v.push_back(1);

else

v.push_back(0);

}

else

break;

} while (1);


for (int i = 0; i < v.size(); i++) 

if (v.at(i) == 1)

cout << "right\n";

else

cout << "wrong\n";

}