이 문제는 관찰과 약간의 산수(?)를 통해 해결할 수 있다. 벌집은 육각형으로 이루어져 있고, 계속 중심의 육각형을 감싸는 방식으로 확장하므로, 바깥쪽 둘레는 항상 안쪽보다 6씩 더 길어진다. 그 점에 착안하여 공식을 세우면 된다
<코드>
#include <iostream>
#define endl '\n'
using namespace std;
int cnt,n,m=1;
int main()
{
ios::sync_with_stdio(false);cin.tie(NULL);
cin>>n;
while(n>m){
cnt++;
m+=6*cnt;
}
cout<<cnt+1<<endl;
return 0;
}
def main():
n = int(input())
if n == 1:
return n
else:
i = 1
while int((6*i+6)*i/2)+1 <= n-1:
i += 1
return i+1
print(main())