#C9684. Arithmetic Sequences Count
Arithmetic Sequences Count
Arithmetic Sequences Count
You are given two positive integers n and k. Your task is to compute the number of distinct arithmetic sequences of length n that can be formed using the integers from 1 to k under a special rule. In this problem the answer turns out to be determined solely by k regardless of n (when n ≥ 1). In particular, the answer is given by the formula:
$\displaystyle \frac{k(k+1)}{2}$
For example, when n=2 and k=3, the answer is 6. Similarly, when n=3 and k=4, the answer is 10.
inputFormat
The input consists of a single line with two space-separated integers: n and k.
outputFormat
Output a single integer, which is the number of distinct arithmetic sequences computed by the formula .## sample
2 3
6