https://www.acmicpc.net/problem/2903
2903번: 중앙 이동 알고리즘
상근이는 친구들과 함께 SF영화를 찍으려고 한다. 이 영화는 외계 지형이 필요하다. 실제로 우주선을 타고 외계 행성에 가서 촬영을 할 수 없기 때문에, 컴퓨터 그래픽으로 CG처리를 하려고 한다.
www.acmicpc.net
Code
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int box = 1;
while(t-->0) {
box*=4;
}
int l = (int) Math.sqrt(box);
int ans = (l+1) * (l+1);
System.out.println(ans);
sc.close();
}
}
규칙을 발견해서 풀면 된다.
Math.sqrt는 루트라고 보면 된다.
'백준' 카테고리의 다른 글
백준[24723]번 : 녹색거탑 ( JAVA ) (2) | 2023.04.08 |
---|---|
백준[15439]번 : 베라의 패션 ( JAVA ) (0) | 2023.04.08 |
백준[11005]번 : 진법 변환 2 ( JAVA ) (0) | 2023.04.08 |
백준[2745]번 : 진법 변환 ( JAVA ) (2) | 2023.04.08 |
백준[19532]번 : 수학은 비대면강의입니다. ( JAVA ) (0) | 2023.03.22 |