Tax System
InterviewTime limit1sMemory limit1024 MB
Each client's income is taxed through N progressive brackets with given widths and rates; compute the total tax for M clients, printed to two decimals.
- Level
Medium5 of 10
- Topics
- Prefix sum, Binary search, Math, Implementation
- Solved
- No attempts yet
Problem
The country of Umeerika recently decided to switch to a progressive income tax system consisting of tax brackets (numbered ). Each bracket has a taxable income width and a tax rate (in percent). Tax is charged as follows: a person pays percent on the first euros of their annual income, percent on the next euros, and so on. Since , the entire income is taxed.
Write a program that, for clients, computes the total tax owed on each client's income.
Input
The first line contains the number of tax brackets (). The second line contains integers (); the width of the last bracket, , is not given in the input (when this line is empty). The third line contains integers (). The fourth line contains the number of clients (). Each of the next lines contains one integer ().
Output
Output exactly lines. On the -th line, print the total tax owed on income . Print each amount with exactly two digits after the decimal point.