#B4467. 分摊水费 / bill

    ID: 16865 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 1 上传者: 标签>2025O2优化山西分支结构科创活动小学活动

分摊水费 / bill

Problem Description

Xiaoshan and Xiaoxi share an apartment and need to split the monthly water bill together. The water bill uses a tiered pricing system with the following rules:

  1. For the portion of total monthly water usage not exceeding 1010 cubic meters (including 1010 cubic meters), the rate is 44 yuan per cubic meter.
  2. For the portion of total monthly water usage exceeding 1010 cubic meters, the rate is 55 yuan per cubic meter.

Xiaoshan uses aa cubic meters of water per month, and Xiaoxi uses bb cubic meters of water per month.

They have agreed on a set of rules for splitting the total cost:

  1. If the total water usage does not exceed 1010 cubic meters, they split the cost equally.
  2. If the total water usage exceeds 1010 cubic meters, the cost for the first 1010 cubic meters is split equally, and the cost for the portion exceeding 1010 cubic meters is paid entirely by the person who uses more water (either aa or bb).

Input Format

A single line containing two integers aa and bb, representing the water usage contributed by Xiaoshan and Xiaoxi respectively (in cubic meters). It is guaranteed that aa is not equal to bb.

Output Format

A single line containing two integers separated by a space, representing the final water bill amounts that Xiaoshan and Xiaoxi should pay respectively (in CNY).

5 4
18 18
5 6
20 25

Hint

[Sample 11 Explanation]

5+4<105+4<10, therefore they split the bill equally.

Total bill: (5+4)×4=36(5+4)\times 4 = 36, Split equally, so each person pays 1818 yuan.

[Sample 22 Explanation]

5+6>105+6>10, therefore they do not split the bill equally.

For the first 1010 cubic meters: (5+5)×4=40(5+5)\times 4 = 40;

For the portion exceeding 1010 cubic meters: (5+610)×5=5(5+6-10)\times 5 = 5;

They split the 4040 equally, and the remaining portion is paid by Xiaoxi. Therefore, Xiaoshan pays 2020 yuan, and Xiaoxi pays 2525 yuan.

[Constraints]

For 30%30\% of the test cases, 0a,b50 \le a, b \le 5.

For another 30%30\% of the test cases, 5<a,b205 < a, b \le 20.

For 100%100\% of the test cases, 0a,b200 \le a, b \le 20, and aba \neq b.


Translated by DeepSeek-V3