O(n) Stress Test 1 Series Sum
Submit solution
Points:
100
Time limit:
8.0s
Memory limit:
256M
Author:
Problem type
Allowed languages
C, C++
You are given two positive integers \(l\) and \(r\) with \(l \le r\). Compute the sum of the \(r - l + 1\) integers \(l, l+1, \ldots, r\) modulo \(2^{64}\).
Input
The input consists of two integers \(l\) and \(r\) (\(1 \le l \le r \le 10^{10}\)).
Output
Output a single integer representing the required value.
Sample Input 1
1 100
Sample Output 1
5050
Sample Input 2
1 10000000000
Sample Output 2
13106511857580896768