AtCoder Grand Contest 068
A
Circular Distance
AtCoder
⌀ 2948
原题
←B →
翻译中…

Problem Statement

翻译中…

There is a circle with circumference $L$, and $L$ people are standing equally spaced along the circumference. They are labeled as person $0, 1, \cdots, L-1$ in clockwise order. Consider choosing $N$ from these $L$ people. The cost of a choice is defined as follows.

翻译中…
  • For every pair of persons among the $N$ chosen people, find the minimum distance one person has to move along the circumference to reach the other person's position. The maximum value among these distances is the cost.
翻译中…

Find the sum of costs over all possible choices, modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq L \leq 10^6$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

L N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4 2
Output #1
8
The choices of $N$ people and their corresponding costs are as follows: - $(0,1)$: cost $1$ - $(0,2)$: cost $2$ - $(0,3)$: cost $1$ - $(1,2)$: cost $1$ - $(1,3)$: cost $2$ - $(2,3)$: cost $1$ The sum of these costs, $8$, is the answer.
Input #2
5 5
Output #2
2
We can only choose all of them. In this case, the cost is $2$.
Input #3
13 5
Output #3
7618
Input #4
1000000 100000
Output #4
664396470
题目信息
题号
agc068_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。