๐ฆ ์๋ ๋ก๊ทธ ์๊ณ
1. ๋ฌธ์ ๋งํฌ
PCCP 3๋ฒ: ์๋ ๋ก๊ทธ ์๊ณ
2. ์ฝ๋
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def solution(h1, m1, s1, h2, m2, s2):
# ๋ถ์นจ๊ณผ ์ด์นจ์ ์ ์๋ฅผ ์ ์ธํ๊ณ 1๋ถ์ 1๋ฒ์ฉ ๋ง๋๋ค
setha_minutes = [((3600 * i) / (60 - 1)) for i in range(86400)]
# ์์นจ๊ณผ ์ด์นจ์ 12์ ์ค๋ณต์ ์ ์ธํ๊ณ 1๋ถ์ 1๋ฒ์ฉ ๋ง๋๋ค
setha_hours = [((3600 * i) / (60 - 1/12)) for i in range(86400)]
begin = h1 * 3600 + m1 * 60 + s1
end = h2 * 3600 + m2 * 60 + s2
meet = []
for i in range(86400):
if begin <= setha_hours[i] <= end and setha_hours[i] not in meet:
meet.append(setha_hours[i])
if begin <= setha_minutes[i] <= end and setha_minutes[i] not in meet:
meet.append(setha_minutes[i])
return len(meet)
- ํ
์คํธ ๊ฒฐ๊ณผ
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
์ฑ์ ์ ์์ํฉ๋๋ค. ์ ํ์ฑ ํ ์คํธ ํ ์คํธ 1 ใ ํต๊ณผ (54.86ms, 16.9MB) ํ ์คํธ 2 ใ ํต๊ณผ (46.64ms, 16.8MB) ํ ์คํธ 3 ใ ํต๊ณผ (47.21ms, 16.8MB) ํ ์คํธ 4 ใ ํต๊ณผ (41.42ms, 16.7MB) ํ ์คํธ 5 ใ ํต๊ณผ (69.59ms, 16.7MB) ํ ์คํธ 6 ใ ํต๊ณผ (35.87ms, 16.8MB) ํ ์คํธ 7 ใ ํต๊ณผ (46.98ms, 16.7MB) ํ ์คํธ 8 ใ ํต๊ณผ (44.41ms, 16.7MB) ํ ์คํธ 9 ใ ํต๊ณผ (53.15ms, 16.8MB) ํ ์คํธ 10 ใ ํต๊ณผ (53.21ms, 16.9MB) ํ ์คํธ 11 ใ ํต๊ณผ (39.14ms, 16.8MB) ํ ์คํธ 12 ใ ํต๊ณผ (35.08ms, 16.7MB) ํ ์คํธ 13 ใ ํต๊ณผ (76.28ms, 16.8MB) ํ ์คํธ 14 ใ ํต๊ณผ (59.90ms, 16.7MB) ํ ์คํธ 15 ใ ํต๊ณผ (45.67ms, 16.9MB) ํ ์คํธ 16 ใ ํต๊ณผ (57.40ms, 16.7MB) ํ ์คํธ 17 ใ ํต๊ณผ (40.80ms, 16.7MB) ํ ์คํธ 18 ใ ํต๊ณผ (38.97ms, 16.7MB) ํ ์คํธ 19 ใ ํต๊ณผ (80.01ms, 16.8MB) ํ ์คํธ 20 ใ ํต๊ณผ (84.69ms, 16.7MB) ์ฑ์ ๊ฒฐ๊ณผ ์ ํ์ฑ: 100.0 ํฉ๊ณ: 100.0 / 100.0
3. ํด์ค
๋ถ์นจ๊ณผ ์ด์นจ์ ์ ์๋ฅผ ์ ์ธํ๊ณ 1๋ถ์ 1๋ฒ์ฉ ๋ง๋๋ค
์์นจ๊ณผ ์ด์นจ์ 12์ ์ค๋ณต์ ์ ์ธํ๊ณ 1๋ถ์ 1๋ฒ์ฉ ๋ง๋๋ค
์์ ์๊ฐ๊ณผ ์ข ๋ฃ ์๊ฐ์ ์ด๋ก ๋ํ๋ด์ด ๋ชจ๋ ๊ฒน์น๋ ํ์๋ฅผ ๊ตฌํ๋ค
This post is licensed under CC BY 4.0 by the author.