#abc099b. B - Stone Monument

B - Stone Monument

Score : 200200 points

问题陈述

在某个村庄中,从西向东有 999999 座塔,高度分别为 1,(1+2),(1+2+3),...,(1+2+3+...+999)1,(1+2),(1+2+3),...,(1+2+3+...+999) 米,每座塔之间的间隔为 11 米。

雪一直下到最终停止。对于相距 11 米的任意两座相邻的塔,我们测量了这两座塔未被雪覆盖的部分长度,结果是西边的塔高为 aa 米,东边的塔高为 bb 米。

假设整个村庄内雪的覆盖深度和海拔高度处处相同,请找出雪的覆盖厚度。

同时假设雪的覆盖深度至少为 11 米。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

In some village, there are 999999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999)1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 11 meter.

It had been snowing for a while before it finally stopped. For some two adjacent towers located 11 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are aa meters for the west tower, and bb meters for the east tower.

Assuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.

Assume also that the depth of the snow cover is always at least 11 meter.

Constraints

  • 1a<b<499500(=1+2+3+...+999)1 \leq a < b < 499500(=1+2+3+...+999)
  • All values in input are integers.
  • There is no input that contradicts the assumption.

Input

Input is given from Standard Input in the following format:

aa bb

Output

If the depth of the snow cover is xx meters, print xx as an integer.

Sample Input 1

8 13

Sample Output 1

2

The heights of the two towers are 1010 meters and 1515 meters, respectively. Thus, we can see that the depth of the snow cover is 22 meters.

Sample Input 2

54 65

Sample Output 2

1

update @ 2024/3/10 17:18:59