๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’๊ณต๋ถ€/์•Œ๊ณ ๋ฆฌ์ฆ˜

[๋ฐฑ์ค€] 2447๋ฒˆ ๋ณ„์ฐ๊ธฐ-10

by rindev 2020. 12. 19.

๋ณ„์„ why..

www.acmicpc.net/problem/2447

 

2447๋ฒˆ: ๋ณ„ ์ฐ๊ธฐ - 10

์žฌ๊ท€์ ์ธ ํŒจํ„ด์œผ๋กœ ๋ณ„์„ ์ฐ์–ด ๋ณด์ž. N์ด 3์˜ ๊ฑฐ๋“ญ์ œ๊ณฑ(3, 9, 27, ...)์ด๋ผ๊ณ  ํ•  ๋•Œ, ํฌ๊ธฐ N์˜ ํŒจํ„ด์€ N×N ์ •์‚ฌ๊ฐํ˜• ๋ชจ์–‘์ด๋‹ค. ํฌ๊ธฐ 3์˜ ํŒจํ„ด์€ ๊ฐ€์šด๋ฐ์— ๊ณต๋ฐฑ์ด ์žˆ๊ณ , ๊ฐ€์šด๋ฐ๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ์นธ์— ๋ณ„์ด

www.acmicpc.net

 

why.. ์™œ ๊ผญ ์ด๋ ‡๊ฒŒ ๋ณ„์„ ์ฐ๊ณ ์‹ถ์—ˆ๋Š”์ง€ ์•Œ ์ˆ˜๊ฐ€ ์—†์ง€๋งŒ..

 

์ •๋ง ๋ชจ๋ฅด๊ฒ ์–ด์„œ ๊ฒ€์ƒ‰ํ•ด๋ดค๊ธฐ ๋•Œ๋ฌธ์— ๋จผ์ € ํ’€์–ด๋ณด์‹ ๋ถ„๋“ค๊ป˜ ํ•ญ์ƒ ๊ฐ์‚ฌํ•œ ๋งˆ์Œ๋ฟ์ž…๋‹ˆ๋‹ค๐Ÿ™‡‍โ™€๏ธ

 

 

์ผ๋‹จ ์˜ˆ์‹œ๋Š” ๊ฐ€๋ณ๊ฒŒ 9๋กœ ์‹œ์ž‘(์ด๋ฏธ์ง€๊ฐ€ ๊ธธ์–ด์„œ ์„ค๋ช…๋„ ๊ธธ์–ด์งˆ ์˜ˆ์ •..)

 

 

 

๐Ÿ™‹‍โ™€๏ธ ์ž‘์„ฑํ•œ ์ฝ”๋“œ

๋”๋ณด๊ธฐ

 

ํ…Œ์ŠคํŠธ ํ•˜๊ธฐ ์œ„ํ•œ print๋„ ๋‹ค ๋“ค์–ด์žˆ์Œ...๐Ÿ˜–

# 2447 ๋ฒˆ : ๋ณ„์ฐ๊ธฐ-10
def recursive_2447():
  n = int(input()) #ํ•œ ๋ณ€์˜ ํฌ๊ธฐ
  
  def make_star(x,y,n):
    print('start making stars')
    if x//n % 3 == 1 and y//n % 3 == 1:
      print(x,y,n)
      print(' ', end='')
    else:
      if n // 3 == 0:
        print('n : ',n)
        print('*', end='')
      else:
        print('else..')
        make_star(x,y,n//3)

  for x in range(n):
    print('-------------------------x : ',x)
    for y in range(n):
      print('--------------------y : ',y)
      make_star(x,y,n)
    print('')
  

 

๋Œ“๊ธ€