길이가 서로 다른 A,B,C 세 개의 막대 길이가 주어지면 이 세 막대로 삼각형을 만들 수 있으면 "Yes!!😎"를 출력하고, 만들 수 없으면 "Nooooo..😭" 를 출력한다.
첫 번째 줄에 100이하의 서로 다른 A,B,C 막대의 길이가 입력된다.
첫 번째 줄에 "예쓰" , "노우"를 출력한다.
6, 7, 11
Yes!!😎
<html>
<head>
<meta charset="UTF-8" />
<title>출력결과</title>
</head>
<body>
<script>
function solution(a, b, c) {
// 삼각형의 조건
// a+b > c
let answer = "Yes!!😎"
let max
let total = a + b + c
if (a > b) max = a
else max = b
if (max < c) max = c
if (total - max <= max) answer = '"Nooooo..😭"'
return answer
}
console.log(solution(6, 7, 11))
</script>
</body>
</html>
삼각형이 될 수 있는 조건은 (가장 큰 변 > 나머지 두 변의 합) 이다.