algorithm'''problem solve
[백준]4153-직각삼각형(설명X)
JunHwa Park
2019. 8. 15. 17:37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
while (a != 0 && b != 0 && c != 0) {
bool isRight = false;
if (a > b && a > c) {
if (a * a == b * b + c * c)
isRight = true;
}
else if (b > a && b > c) {
if (b * b == a * a + c * c)
isRight = true;
}
else {
if (c * c == a * a + b * b)
isRight = true;
}
if (isRight)
cout << "right" << endl;
else
cout << "wrong" << endl;
cin >> a >> b >> c;
}
}
|
cs |
피타고라스 정리 이용하면 된다.