반응형
1330 두 수 비교하기
a,b = map(int , input().split())
if a > b:
print('>')
elif a < b:
print('<')
else:
print('==')
split()를 통한 input값을 공백단위로 분할
map을 통한 int로 형변환
2753 윤년
a = int(input())
if (a%4==0 and a%100!=0) or a%400==0: # (4의 배수 and 100의 배수 안됨) or 400의 배수
print(1)
else:
print(0)
14681 사분면 고르기
x = int(input())
y = int(input())
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)
2884 알람시계
h,m = map(int , input().split()) # 시간 분 입력 받음
if m-45 < 0: # 분이 45분보다 작을 경우
m = 60+m-45
if h == 0: # 시간이 0인 경우 따로 처리
h = 23
else:
h = h-1
else:
m = m-45
print(h,m)
반응형
'코딩테스트 > 백준 준비(과거)' 카테고리의 다른 글
(파이썬) 백준 1712, 1193, 2869, 10250, 2775, 2839, 1011 (0) | 2021.07.06 |
---|---|
(파이썬) 백준 11654, 11720, 10809, 2675, 1157, 1152, 2908, 5622, 2941, 1316 (0) | 2021.06.27 |
(파이썬) 백준 4673, 1065 (0) | 2021.06.26 |
(파이썬) 백준 10818, 2562, 2577, 3052, 1546, 8958, 4344 (0) | 2021.06.26 |
(파이썬) 백준 2739, 15552, 11022, 2439, 10871, 10952, 1110 (0) | 2021.06.24 |
댓글