일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- mac hadoop
- 도커 교과서
- hive beeline
- mac hadoop 설정
- hive beeline 실행
- 백준 18428
- 카카오 자물쇠와 열쇠
- mac hadoop 설치
- hive beeline 설정
- 기업 조사 빨리 하는 법
- Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000
- 이더리움
- Resources are low on NN
- Safe mode is ON
- mac hive 3
- mac hive
- hadoop safe mode leave
- 카카오 2020 코딩테스트
- 이더리움 #ethereum
- 자소서 시간 줄이기
- hadoop safe mode
- hive beeline 에러
- 자소서 빨리 쓰는 법
- Failed to connect to localhost:10000
- is not allowed to impersonate hive (state=08S01
- 카카오 2020 코테
- mac hadoop 3
- 자소서 너무 오래 걸림
- code=0)
- 자소서 빨리
Archives
- Today
- Total
A seeker after truth
exercism leap solution 본문
P)
Given a year, report if it is a leap year.
The tricky thing here is that a leap year in the Gregorian calendar occurs:
```text
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400
```
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap
year, but 2000 is.
mysol)
def leap_year(year):
if year%4 == 0:
if year%100 == 0:
if year%400 == 0:
return True
return False
return True
else:
return False
S2)
def is_leap_year(x): # 디논 때 배웠던 진리표 아이디어 활용! 대신 명제를 첨부터 잘 설정해야함.
# 400의 배수는 무조건 100의 배수이므로 뒤쪽 명제만 참이면 된다. 하필 or를 쓴 이유를 생각해볼 것. 그리고 != 를 쓴 이유도.
return x % 4 == 0 and (x % 100 != 0 or x % 400 == 0)
'Algorithm > 문제풀이' 카테고리의 다른 글
exercism RNA-transcription solution (0) | 2020.01.24 |
---|---|
exercism pangram solution (0) | 2020.01.24 |
exercism reverse-string solution (0) | 2020.01.24 |
프로그래머스 정렬 문제풀이(1) (0) | 2020.01.24 |
문제5 (0) | 2020.01.08 |