๋ฌธ์
https://www.acmicpc.net/problem/2447
2447๋ฒ: ๋ณ ์ฐ๊ธฐ - 10
์ฌ๊ท์ ์ธ ํจํด์ผ๋ก ๋ณ์ ์ฐ์ด ๋ณด์. N์ด 3์ ๊ฑฐ๋ญ์ ๊ณฑ(3, 9, 27, ...)์ด๋ผ๊ณ ํ ๋, ํฌ๊ธฐ N์ ํจํด์ N×N ์ ์ฌ๊ฐํ ๋ชจ์์ด๋ค. ํฌ๊ธฐ 3์ ํจํด์ ๊ฐ์ด๋ฐ์ ๊ณต๋ฐฑ์ด ์๊ณ , ๊ฐ์ด๋ฐ๋ฅผ ์ ์ธํ ๋ชจ๋ ์นธ์ ๋ณ์ด
www.acmicpc.net
ํ์ด
# ๋ฐฑ์ค 2447๋ฒ ๋ฌธ์ - ๋ณ ์ฐ๊ธฐ 10
n = int(input())
def star(l):
if l == 3:
return ['***','* *','***']
arr = star(l//3)
stars = []
for i in arr:
stars.append(i*3)
for i in arr:
stars.append(i+' '*(l//3)+i)
for i in arr:
stars.append(i*3)
return stars
print('\n'.join(star(n)))
'๐๏ธ Algorithm > ๐ฉ ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 9251๋ฒ_LCS (0) | 2023.04.21 |
---|---|
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 1011๋ฒ_Fly me to the Alpha Centauri (0) | 2023.04.21 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold4] 7662๋ฒ_์ด์ค ์ฐ์ ์์ ํ (0) | 2023.04.20 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold3] 1520๋ฒ_๋ด๋ฆฌ๋ง ๊ธธ (0) | 2023.04.19 |
๐ฉ [๋ฐฑ์ค] [Python] [Silver1] 1991๋ฒ_ํธ๋ฆฌ ์ํ (0) | 2023.04.19 |