CF616E.Sum of Remainders

提高+/省选-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Calculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + ... + n mod m. As the result can be very large, you should print the value modulo 109 + 7 (the remainder when divided by 109 + 7).

The modulo operator a mod b stands for the remainder after dividing a by b. For example 10 mod 3 = 1.

计算以下和式的值:n mod 1+n mod 2+n mod 3+⋯+n mod mn \bmod 1 + n \bmod 2 + n \bmod 3 + \dots + n \bmod m。由于结果可能非常大,你应输出该值对 109+710^9 + 7 取模的结果(即除以 109+710^9 + 7 后的余数)。

取模运算符 a mod ba \bmod b 表示 aa 除以 bb 后的余数。例如,10 mod 3=110 \bmod 3 = 1。

输入格式

The only line contains two integers n, m (1 ≤ n, m ≤ 1013) — the parameters of the sum.

唯一一行包含两个整数 nn 和 mm(1≤n,m≤10131 \leq n, m \leq 10^{13})——该求和式的参数。

输出格式

Print integer s — the value of the required sum modulo 109 + 7.

输出整数 ss —— 所求和对 109+710^9 + 7 取模的结果。

输入输出样例

  • 输入#1

    3 4

    输出#1

    4
  • 输入#2

    4 4

    输出#2

    1
  • 输入#3

    1 1

    输出#3

    0

输入解题思路,AI测评打分。不知道怎么写?

首页