알고리즘/백준 알고리즘
백준 2292번 벌집[C++]
빠켱이
2021. 2. 22. 02:23
#include <iostream>
using namespace std;
int n, result = 1;
int main(){
scanf("%d", &n);
n -= 1;
if(n == 0){
printf("1");
return 0;
}
while(1){
n -= (result++*6);
if(n <= 0)
break;
}
printf("%d", result);
}