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 Fempty boxes in total.
LIMITS
1< N,K,T,F <1000000
Input
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
solve it
No. It looks far to easy to be worth my time. Perhaps if you post the code you have so far I'll help![]()
Meh i hate those homeworks that you have to think and not accually code D:
If you show that you're trying someone might accually help
This question was a part of a college contest the guy was planning to cheat onYou had to solve 7 such problems in about 6 hours , the one who solves max wins. ( I know cause i too was in it ... and won )
I managed to solve this question but the selection process seems to be running T+1 times not T (for the given output to match the given input) :/. I recon the problem setter isn't considering the first time we select out of N as one of the T times of the 'process'.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks