Submit | All submissions | Best solutions | Back to list |
BUILDTOW - Build the Tower |
8. Build the Tower
The president of Yanyang University has decided to build a new tower in front of the auditorium and has invited the students of SCE to help with the project. The tower is one of a kind and is made up of N cuboids one over the other. Each cuboid has a height of 1 unit and the length and breadth of a cuboid is equal. The top most cuboid’s length is 1 unit. The cuboid below it has a length of 2. All the cuboids below it have their lengths equal to the sum of the lengths of the 2 cuboids above it.
Cuboid |
Length |
Breadth |
Height |
1 |
1 |
1 |
1 |
2 |
2 |
2 |
1 |
3 |
3 |
3 |
1 |
4 |
5 |
5 |
1 |
5 |
8 |
8 |
1 |
As a token of appreciation the president has decided to give SCE a grant of
$ ((Volume of Tower) % 1000000007)
Your task is to calculate the amount of grant received by SCE for a given value of N.
Input
The first line contains the number of test cases (T) followed by T lines each containing a single integer N.
Output
For each test case output the grant that SCE receives for building the tower.
Constraints
T <= 20, N <= 10^18
Example
Sample Input
2 5 10
Sample Output
$103 $12815
Added by: | Saransh Bansal |
Date: | 2012-03-21 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
|||||
2013-12-21 17:00:16 Rohan Phadke
am getting SIGSEGV.. am pretty sure i have written the '&' for every scanf statement(C).. could anyone help me? <snip> Last edit: 2022-12-20 23:34:23 |
|||||
2014-12-08 20:56:50 aqfaridi
do some paperwork.. |
|||||
2013-01-25 20:08:38 yaswanth
compilation error!! can anybody help me plzz?? <snip> Last edit: 2022-12-20 23:34:27 |
|||||
2012-10-25 11:48:32 J.A.R.V.I.S.
@Akhil $389369281 $772414878 |
|||||
2012-07-15 21:47:06 Akhil Mittal
gettin WA!! what will be the output for 10^18 and (10^18)-1??? |
|||||
2012-06-18 13:02:07 PubLic_AvenGeR
Work out for an O(lg n) soln.... |
|||||
2012-06-07 14:54:56 vaibhav gupta
How to avoid TLE in this question..?? |
|||||
2012-03-30 12:26:53 Ikhaduri
nice problem |
|||||
2012-03-27 17:36:26 RAJDEEP GUPTA
@srikanth: yes u must include dollar in output. and no space in between dollar and the number. |
|||||
2012-03-27 10:42:39 srikanth reddy
should dollar be included in the output.if so is there a space between dollar and the number? |