Code&Data Insights

BaekJoon Algorithm - Stage 2 [ 1-5 ] ( Python 3 ) 본문

Algorithm/BaekJoon Online Judge

BaekJoon Algorithm - Stage 2 [ 1-5 ] ( Python 3 )

paka_corn 2022. 1. 13. 11:12

 

2022.01.12

 

 

 

#1  Python - If문 

 

 

#2 윤년 표시하기 

조건 : ( y % 4 == 0 and y % 100 != 0 ) or y % 400 == 0 

 

 

#3 사분면 고르기

java와 다른점 

&&  == and

|| == or 

--> 그냥 영어로 써도 됨, () 필요 X 

  

 

#4 알람시계

 

45분 일찍 알람 설정하기

 

[my code]

 

time = input().split(' ')

h = int(time[0])
m = int(time[1])

if 45 <= m <= 60 :
    m -= 45
    print(h,m)
elif 0 <= m < 45 :
    m += 15
    h -= 1
    if h < 0 :
        h += 24
        print(h,m)
    else :
        print(h,m)

 

 

 

 

Comments