티스토리 뷰

Difficulty : Silver V

Problem Description

Two dates are given. First is start date, and second is end date.

If the difference between two dates is over 1000 years, the result is 'gg'.

Otherwise, the result is 'D-x'. 'x' means the difference of two dates.

 

Solution

Import datetime to use date library.

First, store two dates at (y1, m1, d1) and (y2, m2, d2).

Compare two dates if the difference is over 1000 years.

Otherwise, print the difference of two dates using 'datetime.date'. 

 

Today's Code

datetime.date(yy, mm, dd) : 날짜 관련 변수, datetime을 import해야 함. 덧셈과 뺄셈이 가능하다.

X.days : 시간을 제외하고 날짜만을 출력한다.

 

Today's English

 

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

'프로그래밍 문제풀이 > 백준 문제풀이' 카테고리의 다른 글

1018번: 체스판 다시 칠하기  (0) 2022.10.22
1157번: 단어 공부  (0) 2022.10.22
1874번: 스택 수열  (0) 2022.10.20
1010번: 다리 놓기  (0) 2022.10.19
1271번: 엄청난 부자2  (0) 2022.10.17
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/06   »
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
29 30
글 보관함