编程介的小学生 2017-10-03 22:24 采纳率: 0.9%
浏览 849
已采纳

Taxes

Description

There is a taxation system based on the known parameters N1...Nm, S1...Sm+1 in some country.

Let the total annual income of a citizen is equal to K bibriks (bibrik is a local currency). A citizen pays S1 percents from the sum N1 bibriks and less, he pays S1 percents of N1 plus S2 percents of (K-N1) from the sum from N1 to N2. If the income is N2 <= K <= N3 then the citizen must pay S1 percents of N1 plus S2 percents of (N2 - N1) plus S3 percents of (K - N2) and so on.

If the total annual income exceeds Nm then he is to pay S1 percents of N1 plus S2 percents of (N2 - N1) plus … plus Sm+1 percents of (K - Nm)

Let the function T(K) be the total tax from the annual income K. Moreover, in the assumed country the government pays to the citizens additional L percents as the regional coefficient. This coeficient is taxed independently from the salary.

I.e. if the salary of a citizen is R bibriks he may legally spend R – T(R) + L%*R – T(L%*R). The taxes to pay are T(R) + T(L%*R).

The calculation of the regional coefficient and all kinds the taxes is made with rounding off to two digits after a decimal point. The initial income is given within two digits after a decimal point too.

Each employer automatically retains the taxes in favor of the government from the annual income of his employee taking into account the regional coefficient.

If a citizen works at several places, in the end of a year he is to make a recalculation of the payed taxes because the sum of retained taxes in different places may be not equal to the tax from the total income.

You are to write a program that calculates and outputs the difference between the tax from the total income and the sum that is retained by all his employers.
Input

The first line contains the regional coefficient L. Then there are pairs N1 S1, N2 S2, ..., Nm Sm, 0 Sm+1. Each pair is located in a separate line. The number in pairs are separated by one or several spaces. The values of L and coefficients Si are given in percents (i.e. they are integers from 0 to 99).

Each of the next lines contains the total annual net profit of the citizen on some enterprise, where he worked, taking into account the regional coefficient and taxes.

The input is ended by −1. All the parameters are integer not greater than 109 within two digits after a decimal point. The number of different workplaces of the citizen doesn't exceed 30. An amount of taxation coefficients (m) is not greater than 20.
Output

The difference between the tax from the total income and the sum that is retained by all his employers with exactly two digits after a decimal point.
Sample Input

15

12000000 12
24000000 20
36000000 25
48000000 30
0 35
12000000

12000000

-1
Sample Output

937233.19

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-19 11:04
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵