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
kaushalag29:
2017-05-17 20:06:36
AC in one go
|
|
rohit9934:
2017-05-16 10:51:24
Time Limit is 2.3 but acceptable in 0.00 sec with ease. |
|
thiem220894:
2017-02-24 04:37:00
AC in 1 GO!!! |
|
utkarsh538:
2016-03-10 08:01:19
Easy one,Just try out basic maths :) |
|
prateek1985:
2016-02-25 21:47:46
good one :-) |
|
KD :
2016-01-23 14:04:27
nice one !!!!!!!!!!!! |
|
CounterNormalize:
2016-01-21 10:29:17
Problem statement is unclear!!. |
|
vasayashwanth:
2015-07-11 15:12:24
simple math |
|
Dushyant Singh:
2015-04-12 16:41:27
Nice problem. Comments are a bit of spoiler though. |
|
aditi:
2015-03-28 11:18:21
why time limit is 2.369s .... while it is just constant order |
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 |