A. Phoenix and Balance

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Phoenix has nn coins with weights 21,22,…,2n21,22,…,2n. He knows that nn is even.

He wants to split the coins into two piles such that each pile has exactly n2n2 coins and the difference of weights between the two piles is minimized. Formally, let aa denote the sum of weights in the first pile, and bb denote the sum of weights in the second pile. Help Phoenix minimize |a−b||a−b|, the absolute value of a−ba−b.

Input

The input consists of multiple test cases. The first line contains an integer tt (1≤t≤1001≤t≤100) — the number of test cases.

The first line of each test case contains an integer nn (2≤n≤302≤n≤30; nn is even) — the number of coins that Phoenix has.

Output

For each test case, output one integer — the minimum possible difference of weights between the two piles.

Example

input

Copy

2
2
4

output

Copy

2
6

Note

In the first test case, Phoenix has two coins with weights 22 and 44. No matter how he divides the coins, the difference will be 4−2=24−2=2.

In the second test case, Phoenix has four coins of weight 22, 44, 88, and 1616. It is optimal for Phoenix to place coins with weights 22 and 1616 in one pile, and coins with weights 44 and 88 in another pile. The difference is (2+16)−(4+8)=6(2+16)−(4+8)=6.

解题说明:此题是一道数学题,为了保证两堆中差值最小,找规律能发现结果为2^(n/2+1)-2.

#include
#include
#include
#include
#include

using namespace std;

int main()
{
	int t;
	scanf("%d", &t);
	while (t--)
	{
		int n;
		scanf("%d", &n);
		int p = pow(2, n / 2 + 1);
		printf("%d \n", p - 2);
	}
	return 0;

}

 

你可能感兴趣的:(AC路漫漫)