3 views

Uploaded by ashishtrivediscr

Advance C programming

Advance C programming

Attribution Non-Commercial (BY-NC)

- Problem 7
- Problem 6
- Problem 5
- Problem 4
- Problem 3
- Problem 2
- Bitwise Solutions 2010
- Problem 1: Help the Tree of Souls
- ASPHand Book
- The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
- Sapiens: A Brief History of Humankind
- Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
- Shoe Dog: A Memoir by the Creator of Nike
- The Library Book
- The Unwinding: An Inner History of the New America
- Never Split the Difference: Negotiating As If Your Life Depended On It
- Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
- Yes Please
- A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
- Grit: The Power of Passion and Perseverance

You are on page 1of 2

(300 points)

After the victory over the humans, Jake Sully has permanently transferred

his consciousness to his Avatar form and is now the new leader of the Na’vi.

There is no more threat now, but the Na’vi sustained severe damages during

the battle with the humans. So it’s time to rebuild their homeland. Jake asks

his scientist friends to help design a new and more improved settlement for the

Na’vi. After a lot of deliberation, the final design is made. The total land

area is segmented in the form of a N × 4 grid and buildings are constructed

at the centre of each grid square. Assume that each square in the grid is of

equal dimension. Successive buildings that lie along neighbouring grid squares

are connected by a tunnel. Also, for every horizontal row of four buildings, the

fourth building is directly connected to the first and second buildings by two

seperate tunnels.

Now, they wish to place guards in some of the tunnels for security. A guard in

tunnel is responsible only for the security of the two houses at the end of the

tunnel. In order to optimize, they have decided to place guards in only some of

the tunnels so that each house is guarded by one and only one guard. They wish

to find out in how many ways they can choose the tunnels for placing guards so

that this task can be accomplished. Your job is to help them find the number

of ways they can choose tunnels to put the guards in.

Input format:

For each of the following T lines, there is one integer N specifying the size of

the N × 4 grid.

Output format:

For each test case, output a single integer (modulo 1000) denoting the num-

ber of ways in which the tunnels may be chosen for putting guards in. The

answer to each test case should appear on a new line.

Sample Input:

2

1

3

6

Sample Output:

36

197

- Problem 7Uploaded byashishtrivediscr
- Problem 6Uploaded byashishtrivediscr
- Problem 5Uploaded byashishtrivediscr
- Problem 4Uploaded byashishtrivediscr
- Problem 3Uploaded byashishtrivediscr
- Problem 2Uploaded byashishtrivediscr
- Bitwise Solutions 2010Uploaded byashishtrivediscr
- Problem 1: Help the Tree of SoulsUploaded byashishtrivediscr
- ASPHand BookUploaded byarchana_chary16