시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 19 | 15 | 13 | 76.471% |
George has won the lottery and, being a nice guy, has decided to spread the wealth around. However, monetary gifts can be taxed once they get over a certain size—the amount of tax depends on how much his friends have earned that year.
The amount of tax paid depends on tax bands. The bands start at zero. Each one takes a certain cut of income from the range of pre-tax income it covers. The final tax band applies to all income above its lower bound.
George is a savvy fellow and knows the number of tax bands, the amount of money each friend has earned and the amount he wants each friend to walk away with.
How much should George give to each friend before tax?
Tax bands will be given in increasing order.
Each line should contain one real number: the amount of money George will give to his friend, in order to arrive at the correct amount after they have paid tax.
All output must be accurate to an absolute or relative error of at most 10−6.
1 1000 0 20 3 0.0 500 999.5 500 1000.0 500
500.000000 624.875000 625.000000
3 4750.50 0 8000 20 10000 40 60 3 0 10000 10000 5000 15000 5000
11312.375000 7416.500000 8624.750000
ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2016 A번