Java/알고리즘
[Java] 백준 2292번 : 벌집
EricJeong
2019. 8. 21. 16:11
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 6 + 12 + 18 + 24 ...
Scanner in = new Scanner(System.in);
int num = in.nextInt();
int sum = 1;
int count = 1;
while(sum < num) {
sum += count++*6;
}
System.out.println(count);
}
}