[백준] C# : 중앙 이동 알고리즘 (2903번)

ssu_hyun·2022년 8월 6일
0

Data Structure & Algorithm

목록 보기
48/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            /// <summary>
            /// 과정을 한 번 거칠 수록 한 변의 사각형이 2배씩 늘어난다는 것을 알 수 있다.
            /// 중복을 제외한 한 변의 점 개수 = 한 변의 사각형 개수 + 1
            /// 전체 점의 개수 = (위 중복 제외 한 변의 점 개수)^2
            /// </summary>
            double n = double.Parse(Console.ReadLine());
            double square = 1 * Math.Pow(2, n);
            double dot = square + 1;
            double result = Math.Pow(dot, 2);

            Console.WriteLine(result);
        }
    }
}

0개의 댓글