Page 1 of 1

11667 - Income Tax Hazard II

Posted: Sun Sep 13, 2009 5:24 pm
by mustak
My question is if 50000<=min<=max<=200000 then in sample input output how min is greater than max in that problem.
edit: Problem number 11667

11667 - Income Tax Hazard (II)

Posted: Mon Sep 14, 2009 3:31 pm
by tryit1

Code: Select all

10000 50000 50002
70000 50000 80000
120000 50000 200000
11111 122222 233333
131111 122222 233333
60000   50000 70000
10000 50000 150000
90000 50000 200000
0 0 0

Case 1: 0.00
Case 2: 1333.36
Case 3: 3266.69
Case 4: 0.00
Case 5: 71.12
Case 6: 500.02
Case 7: 0.00
Case 8: 1066.69

Re: 11667 - Income Tax Hazard (II) explanation needed

Posted: Tue Sep 15, 2009 1:40 pm
by mak(cse_DU)
What does expected amount of tax means?
I am totally unable to realize the problem.
Please explain

problem description:::
Problem Description wrote: you have two find the expected amount of income tax that you need to pay. You should assume that all distinct combinations of S1 and S2 satisfying the above conditions are equally likely.

Re: 11667 - Income Tax Hazard (II)

Posted: Tue Sep 15, 2009 5:16 pm
by mak(cse_DU)
WoW
This is a probability problem.
I have found the hidden description.

But in real life how tax payment can be a probability? confused :roll:

11667 - Income Tax Hazard (II) re statement of problem

Posted: Wed Sep 16, 2009 5:47 pm
by mak(cse_DU)
I am giving extra test case :
Input:

Code: Select all

120000 50000 100000  
400000 50000 200000
0 0 0 
Output:

Code: Select all

Case 1: 9000.00
Case 2: 55000.00
Here hints to solve this problem.

if M<MIN then output must be 0.00
if M>MAX then output .2*(M-MAX)+.1*(MAX-MIN)
But if MIN<=M<=MAX then you have to calculate probability based calculation.

Let TotalSpace=(MAX-MIN+1)*(MAX-MIN+1+1)/2. --> (Total combinations of s1 and s2 ).


Now evaluate below code efficiently.

Code: Select all


res=0.0;
for(i=MIN;i<=M;i++)
           for(j=M;j<=MAX;j++)
                     res+=.1*(M-i)/TotalSpace;

for(i=MIN;i<M;i++)
   for(j=i;j<M;j++){
            res+=.2*(M-j)/TotalSpace;
            res+=.1*(j-i)/TotalSpace;
   }

print res.
MIN,MAX and M are defined in problem statement.

Re: 11667 - Income Tax Hazard (II)

Posted: Fri Oct 23, 2009 6:05 pm
by ltaravilse
Why in test case

70000 50000 80000

I'm getting 1333.33 instead of 1333.36?

It's not a floating point error because I did it by hand and I get 4000/3

Is it wrong 1333.33?

I wonder why did I get so close if it's wrong...