[C#] 2292: 벌집

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            if (n == 1Console.WriteLine(n);
            else
            {
                for (int i = 2; ; i++
                {
                    if (3 * i * i  3 * i + 2 > n)
                    {
                        Console.WriteLine(i);
                        break;
                    }
                }
            }
        }
    }
}
 
 
cs

관련글

제목 작성자 작성일