baekjoon: 2292(벌집)

강지안·2023년 5월 30일
0

baekjoon

목록 보기
39/186

문제

코드

import java.util.Scanner;

public class q2292 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int count = 0; // 방 개수
        int i = 0;
        int N = sc.nextInt();

        while(true) {
            if(i == 0) N -= 1;
            else N -= (6*i);

            count++;
            i++;

            if(N <= 0) break;
        }
        System.out.print(count);
    }
}

0개의 댓글