#include <iostream>
using namespace std;
int main()
{
int room = 1, i = 0;
int N;
cin >> N;
while (1)
{
room = room + 6 * i;
if (N <= room)
{
cout << i + 1 << '\n';
break;
}
else
i++;
}
return 0;
}
알고리즘/백준
#include <iostream>
using namespace std;
int main()
{
int room = 1, i = 0;
int N;
cin >> N;
while (1)
{
room = room + 6 * i;
if (N <= room)
{
cout << i + 1 << '\n';
break;
}
else
i++;
}
return 0;
}