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
Solve my homework (or something)
Started by vivek, Mar 14 2010 02:52 PM
3 replies to this topic
#1
Posted 14 March 2010 - 02:52 PM
|
|
|
#2
Posted 15 March 2010 - 01:21 PM
No. It looks far to easy to be worth my time. Perhaps if you post the code you have so far I'll help :)
#3
Posted 16 March 2010 - 08:48 AM
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
If you show that you're trying someone might accually help
#4
Posted 21 March 2010 - 01:21 AM
This question was a part of a college contest the guy was planning to cheat on :P You 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'.
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'.


Sign In
Create Account

Back to top









