์ƒˆ์†Œ์‹

๐Ÿงฎ PS

๋ฐฑ์ค€ (boj) 1924 ํŒŒ์ด์ฌ - 2007๋…„

  • -

๋ฌธ์ œ ๋งํฌ : https://www.acmicpc.net/problem/1924

 

1924๋ฒˆ: 2007๋…„

์ฒซ์งธ ์ค„์— ๋นˆ ์นธ์„ ์‚ฌ์ด์— ๋‘๊ณ  x(1≤x≤12)์™€ y(1≤y≤31)์ด ์ฃผ์–ด์ง„๋‹ค. ์ฐธ๊ณ ๋กœ 2007๋…„์—๋Š” 1, 3, 5, 7, 8, 10, 12์›”์€ 31์ผ๊นŒ์ง€, 4, 6, 9, 11์›”์€ 30์ผ๊นŒ์ง€, 2์›”์€ 28์ผ๊นŒ์ง€ ์žˆ๋‹ค.

www.acmicpc.net

 

 

1. ๋‚ (day)์˜ ์ดํ•ฉ์„ ๊ตฌํ•œ๋‹ค.

2. ์š”์ผ์€ 7์„ ์ฃผ๊ธฐ๋กœ ๋ฐ˜๋ณต๋˜๋Š” ์ˆœํ™˜์ด๋ฏ€๋กœ, ์ดํ•ฉ % 7 ๋กœ ๋ฌด์Šจ์š”์ผ์ธ์ง€ ์ถœ๋ ฅํ•œ๋‹ค.

 

week = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
sum=0 #๋‚ (day)์˜ ์ด ํ•ฉ
a=[1,3,5,7,8,10,12] #31์ผ์ธ ๋‹ฌ
b=[4,6,9,11] #30์ผ์ธ ๋‹ฌ

m,d = map(int,input().split())

for i in range(1,m): # 1์›”์ธ ๊ฒฝ์šฐ๋Š” 
    if i in a : sum+=31
    elif i in b : sum+=30
    elif i==2 : sum+=28   #2์›”์€ 28์ผ๊นŒ์ง€
    
sum+=d
print(week[sum%7])

 

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค.