반응형
츄르사려고 코딩하는집사입니다.
1. [HackerRank] Type of Triangle 오라클(Oracle)
2. 문제 출처
https://www.hackerrank.com/challenges/what-type-of-triangle/problem
3. 문제
Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the following statements for each record in the table:
- Equilateral: It's a triangle with sides of equal length.
- Isosceles: It's a triangle with sides of equal length.
- Scalene: It's a triangle with sides of differing lengths.
- Not A Triangle: The given values of A, B, and C don't form a triangle.Input FormatExplanation
- Values in the tuple form an Isosceles triangle, because .
Values in the tuple form an Equilateral triangle, because . Values in the tuple form a Scalene triangle, because .
Values in the tuple cannot form a triangle because the combined value of sides and is not larger than that of side . - Sample Output
- Isosceles Equilateral Scalene Not A Triangle
- The TRIANGLES table is described as follows:Each row in the table denotes the lengths of each of a triangle's three sides.
- Sample Input
4. 풀이
-
5. 소스 코드
SELECT
CASE WHEN A+B <= C OR A+C <= C OR B+C <= A THEN 'Not A Triangle'
ELSE CASE WHEN A=B and B=C and A=C then 'Equilateral'
ELSE CASE WHEN A=B or B=C or A=C then 'Isosceles'
ELSE 'Scalene'
END END END
FROM Triangles;
반응형
'알고리즘 > HackerRank' 카테고리의 다른 글
[HackerRank] Japan Population 오라클(Oracle) (0) | 2021.09.27 |
---|---|
[HackerRank] Average Population 오라클(Oracle) (0) | 2021.09.23 |
[HackerRank] Revising Aggregations - Averages 오라클(Oracle) (0) | 2021.09.23 |
[HackerRank] Revising Aggregations - The Sum Function 오라클(Oracle) (0) | 2021.09.23 |
[HackerRank] Employee Names 오라클(Oracle) (0) | 2021.09.14 |
[HackerRank] Weather Observation Station 12 오라클(Oracle) (0) | 2021.09.09 |
[HackerRank] Higher Than 75 Marks 오라클(Oracle) (0) | 2021.09.08 |
[HackerRank] Weather Observation Station 11 오라클(Oracle) (0) | 2021.09.08 |
최근댓글