## 11667 - Income Tax Hazard II

Moderator: Board moderators

mustak
New poster
Posts: 8
Joined: Sun Sep 06, 2009 5:11 pm
Contact:

### 11667 - Income Tax Hazard II

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

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

### 11667 - Income Tax Hazard (II)

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``````

mak(cse_DU)
Learning poster
Posts: 72
Joined: Tue May 30, 2006 5:57 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 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.
Mak
Help me PLZ!!

ltaravilse
New poster
Posts: 1
Joined: Fri Oct 23, 2009 6:00 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...