[TIL] [14681] 사분면 고르기, [2884] 알람 시계

Updated:

backjoon algorithm review.


[14681] 사분면 고르기

image

image


Code

 a = int(input())
b = int(input())

if a == 0 or (-1000 > a and 1000 <a):
    a = int(input())
else:
    x = a
   
if b == 0 or (-1000 > b and 1000 <b):
    a = int(input())
else:
    y = b

if x > 0 and y > 0:
    print("1")

elif x < 0 and y > 0:
    print("2")

elif x < 0 and y < 0:
    print("3")

elif x > 0 and y < 0:
    print("4")

Result

image


[2884] 알람 시계

image

image


Code

 h, m = input().split()

h = int(h)
m = int(m)

if m < 45 and h > 0:
    h = h-1
    m = (60 + m) - 45

elif m < 45 and h == 0:
    h = 23
    m = (60 + m) - 45

else:
    h = h
    m = m - 45


print(h, m)

Result

image