EBOXES - Empty Boxes
N large empty boxes (assume they are of type:1) are initially placed on a table. An unknown number of boxes (type:1) are selected and in each of them K smaller boxes (type:2) are placed. Again an unknown number of type:2 boxes are selected and K boxes of type:3 are placed inside. This process is repeated T times. Now a box is assumed to be empty when it has no smaller boxes inside it. Finally after all the processes are complete let there be F empty boxes in total.
Limits
1< N, K, T, F <1000000Input
First line of the input file contains the number of test cases. Then each line contains 4 integers N, K, T, F as described above.
Output
Each line should contain the total number of boxes on the table.
Example
Input: 1 11 8 2 102 Output: 115
hide comments
Arnabjyoti Kalita:
2015-01-31 07:14:42
Somebody, please provide more test cases...
|
|
gh0sth0und:
2014-12-30 09:17:58
@hummblefool_2 @Rydel
|
|
:.Mohib.::
2014-12-25 20:00:05
Nice problem....AC in 1 go..... :) |
|
kshitij tripathi:
2014-12-22 19:05:45
Easy mathematics..
|
|
DEEPAK KUMAR SINGH:
2014-12-10 19:34:25
@UJtriumphs -thanx for the link.Simple math.Nic Problem.. |
|
Vamsi Krishna Avula:
2014-12-04 20:46:55
basic math, nice problem. |
|
shreya sahu:
2014-10-06 15:50:17
logical one. bit of maths + fun :) |
|
UJtriumphsâ„¢:
2014-10-05 11:28:58
Helped a lot->https://www.physicsforums.com/threads/help-with-empty-boxes-algorithmic-problem.204043/ |
|
Riddhi:
2014-10-05 06:20:59
@Krzysztof
|
|
Krzysztof Suwiñski:
2014-08-18 16:18:16
Putting N large empty boxes isn't part of the repeatable process! It wasn't clear for me. Hope it helps someone. |
Added by: | abhijith reddy d |
Date: | 2009-05-07 |
Time limit: | 2.369s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |