개발자/Baekjoon
2903 backjun 중앙 이동 알고리즘
봉구리
2023. 5. 22. 01:38

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine()); //테스트 케이스 개수
double result= 0;
result = (Math.pow(4,n)+Math.pow(2,n+1)+1);
System.out.println((int)result);
}
}
그냥 등비수열로 풀었다
제곱식을 구할때 함수
Math.pow(2,n) = 2^n