Algorithm
[백준-2292번/Java] 벌집
1984
2022. 11. 10. 15:29
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int honeyHouse = 1;
int d = 6;
int d_cnt = 1;
while (true) {
if (honeyHouse >= N)
break;
honeyHouse += d * d_cnt;
d_cnt++;
}
System.out.println(d_cnt);
sc.close();
}
}
728x90