Algorithm
[소프티어] 지도 자동 구축
쑤야.
2024. 1. 31. 10:21
https://softeer.ai/practice/6280/history?questionType=ALGORITHM
Softeer - 현대자동차그룹 SW인재확보플랫폼
softeer.ai
접근
- 점의 총 개수 → 밑변에 있는 점의 개수 ** 2
- 점 k개 일경우, k-1개의 구간이 존재
- k-1 구간 내에 점이 하나씩 추가된다 → k + k-1이 다음 단계 밑변의 점 개수
코드
import sys
n = int(input())
dp = [0]*(n+1)
dp[0] = 2
for i in range(1, n+1):
dp[i] = 2*dp[i-1]-1
print(dp[n]**2)