Ball coloring
Submissions: 287   Accuracy:

44.26%

  Difficulty: Easy   Marks: 2

Given N balls . All of them are initially  uncolored . You have to color the balls with two colors RED and BLUE such that there can be atmost 2 positions where a RED ball is touching BLUE ball or vice versa. You have to color all the balls.

Find the number of ways in which balls can be colored.

Input:
First line of input contains of an integer 'T' denoting number of test cases. Then T test cases follow. Only line of each test case contains an integer N .

Output:
For each case print an integer corresponding to the answer .


Constraints:
1<=T<=1000
1<=N<=10^5

Example:
Input:

2
1
2


Output

4

Explanation:

Case1: Possible ways to color are {{r},{b}} . So the answer is 2 . 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Hardik Gulati
Author: hardikgulati96


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.