백준 2903 c++

magicdrill·2024년 3월 16일

백준 문제풀이

목록 보기
159/673

백준 2903 c++

#include <iostream>

using namespace std;

int main(void)
{
	int N;
	int temp = 2, i;
	int total= 4;

	cin >> N;
	if (N >= 1 && N <= 15)
	{
		for (i = 0; i < N; i++)
		{
			//0번 :2 / 1번 : 3 / 2번 : 5 / 3번 : 9 / 4번 : 17 / 5번 : 33....
			temp = 2 * temp - 1;
			total = temp * temp;
		}
		cout << total << endl;
	}
	else
	{
		;
	}
	return 0;
}

0개의 댓글