Skip to content

Commit

Permalink
Softeer 지도 자동 구축
Browse files Browse the repository at this point in the history
  • Loading branch information
allrightDJ0108 committed Aug 4, 2023
1 parent c981099 commit 9fbc570
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Binary file added CodingTestStudy1.0/bin/Softeer/lv2_413.class
Binary file not shown.
24 changes: 24 additions & 0 deletions CodingTestStudy1.0/src/Softeer/lv2_413.java
@@ -0,0 +1,24 @@
package Softeer;

import java.io.*;

public class lv2_413 {
//지도 자동 구축
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int N = Integer.parseInt(br.readLine());
double dp[] = new double[N+1]; //점의 개수 저장

for (int i=0; i<N+1; i++) {
//사각형의 개수(행 기준) : 1, 2, 4, 8, 16, ...
//점의 개수 : (사각형의 개수 + 1) ^ 2
dp[i] = Math.pow(2,i) + 1;
}

//출력할 값만 ^2처리 해줌
double result = Math.pow(dp[N], 2);
//.0 제거를 위한 반올림 처리
System.out.println(Math.round(result));
}
}

0 comments on commit 9fbc570

Please sign in to comment.