AtCoder Beginner Contest 163
翻译中…
Problem Statement
翻译中…
We have $N+1$ integers: $10^{100}$, $10^{100}+1$, ..., $10^{100}+N$.
翻译中…
We will choose $K$ or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo $(10^9+7)$.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 2\times 10^5$$1 \leq K \leq N+1$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N K
翻译中…
Output
翻译中…
Print the number of possible values of the sum, modulo $(10^9+7)$.
翻译中…
样例
Input #1
3 2
Output #1
10
The sum can take $10$ values, as follows:
- $(10^{100})+(10^{100}+1)=2\times 10^{100}+1$
- $(10^{100})+(10^{100}+2)=2\times 10^{100}+2$
- $(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\times 10^{100}+3$
- $(10^{100}+1)+(10^{100}+3)=2\times 10^{100}+4$
- $(10^{100}+2)+(10^{100}+3)=2\times 10^{100}+5$
- $(10^{100})+(10^{100}+1)+(10^{100}+2)=3\times 10^{100}+3$
- $(10^{100})+(10^{100}+1)+(10^{100}+3)=3\times 10^{100}+4$
- $(10^{100})+(10^{100}+2)+(10^{100}+3)=3\times 10^{100}+5$
- $(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\times 10^{100}+6$
- $(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\times 10^{100}+6$
Input #2
200000 200001
Output #2
1
We must choose all of the integers, so the sum can take just $1$ value.
Input #3
141421 35623
Output #3
220280457
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。