ALGORITHM/PYTHON

백준 BAEKJOON 33663번 루미의 진정한™ 보라색 찾기 [PYTHON/파이썬]

칼코 2025. 5. 12. 14:53
728x90
반응형

 

 

 

 

 

백준 BAEKJOON 33663번 루미의 진정한™ 보라색 찾기 [PYTHON/파이썬]


<문제 출처> (BRONZE Ⅲ)

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

 

 

 

 

 

 

 

<풀이>

주어진 식에 맞춰서 RGB의 수치를 HSV로 바꿔주면 된다.

 

 

 

 

 

 

 

<코드>

Hlo, Hhi = map(int, input().split())
Slo, Shi = map(int, input().split())
Vlo, Vhi = map(int, input().split())
R, G, B = map(int, input().split())

# V
V, m = max(R, G, B), min(R, G, B)

# S
S = 255 * (V - m) / V

# H
if V == R:
    H = 60 * (G - B) / (V - m)
elif V == G:
    H = 120 + 60 * (B - R) / (V - m)
elif V == B:
    H = 240 + 60 * (R - G) / (V - m)

if H < 0:
    H += 360

# 진정한™ 보라색 찾기
if Hlo <= H <= Hhi and Slo <= S <= Shi and Vlo <= V <= Vhi:
    print("Lumi will like it.")
else:
    print("Lumi will not like it.")

 

 

 

 

 

 

 

728x90
반응형