## 11667 - Income Tax Hazard (II)

Moderator: Board moderators

### 11667 - Income Tax Hazard (II)

Code: Select all
`10000 50000 5000270000 50000 80000120000 50000 20000011111 122222 233333131111 122222 23333360000   50000 7000010000 50000 15000090000 50000 2000000 0 0Case 1: 0.00Case 2: 1333.36Case 3: 3266.69Case 4: 0.00Case 5: 71.12Case 6: 500.02Case 7: 0.00Case 8: 1066.69`

tryit1
Experienced poster

Posts: 119
Joined: Sun Aug 24, 2008 9:09 pm

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

What does expected amount of tax means?
I am totally unable to realize the problem.

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.
Mak
Help me PLZ!!
mak(cse_DU)
Learning poster

Posts: 72
Joined: Tue May 30, 2006 5:57 pm

### Re: 11667 - Income Tax Hazard (II)

WoW
This is a probability problem.
I have found the hidden description.

But in real life how tax payment can be a probability? confused
Mak
Help me PLZ!!
mak(cse_DU)
Learning poster

Posts: 72
Joined: Tue May 30, 2006 5:57 pm

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

I am giving extra test case :
Input:
Code: Select all
`120000 50000 100000  400000 50000 2000000 0 0 `

Output:
Code: Select all
`Case 1: 9000.00Case 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.
Mak
Help me PLZ!!
mak(cse_DU)
Learning poster

Posts: 72
Joined: Tue May 30, 2006 5:57 pm

### Re: 11667 - Income Tax Hazard (II)

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...
ltaravilse
New poster

Posts: 1
Joined: Fri Oct 23, 2009 6:00 pm