CF1717E.Madoka and The Best University

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Madoka wants to enter to "Novosibirsk State University", but in the entrance exam she came across a very difficult task:

Given an integer nn, it is required to calculate ∑lcm⁡(c,gcd⁡(a,b))\sum{\operatorname{lcm}(c, \gcd(a, b))}, for all triples of positive integers (a,b,c)(a, b, c), where a+b+c=na + b + c = n.

In this problem gcd⁡(x,y)\gcd(x, y) denotes the greatest common divisor of xx and yy, and lcm⁡(x,y)\operatorname{lcm}(x, y) denotes the least common multiple of xx and yy.

Solve this problem for Madoka and help her to enter to the best university!

魔笛想要进入“新西伯利亚国立大学”,但在入学考试中她遇到了一道非常困难的题目:

给定一个整数 nn,要求计算对所有满足 a+b+c=na + b + c = n 的正整数三元组 (a,b,c)(a, b, c),表达式 ∑lcm⁡(c,gcd⁡(a,b))\sum{\operatorname{lcm}(c, \gcd(a, b))} 的值。

本题中,gcd⁡(x,y)\gcd(x, y) 表示 xx 与 yy 的最大公约数,lcm⁡(x,y)\operatorname{lcm}(x, y) 表示 xx 与 yy 的最小公倍数。

请帮魔笛解决这道题,助她进入这所顶尖大学!

输入格式

The first and the only line contains a single integer nn (3≤n≤1053 \le n \le 10^5).

第一行且唯一一行包含一个整数 nn(3≤n≤1053 \le n \le 10^5)。

输出格式

Print exactly one interger — ∑lcm⁡(c,gcd⁡(a,b))\sum{\operatorname{lcm}(c, \gcd(a, b))}. Since the answer can be very large, then output it modulo 109+710^9 + 7.

输出一个整数——∑lcm⁡(c,gcd⁡(a,b))\sum{\operatorname{lcm}(c, \gcd(a, b))}。由于答案可能非常大,因此需对 109+710^9 + 7 取模后输出。

输入输出样例

  • 输入#1

    3

    输出#1

    1
  • 输入#2

    5

    输出#2

    11
  • 输入#3

    69228

    输出#3

    778304278

说明/提示

In the first example, there is only one suitable triple (1,1,1)(1, 1, 1). So the answer is lcm⁡(1,gcd⁡(1,1))=lcm⁡(1,1)=1\operatorname{lcm}(1, \gcd(1, 1)) = \operatorname{lcm}(1, 1) = 1.

In the second example, lcm⁡(1,gcd⁡(3,1))+lcm⁡(1,gcd⁡(2,2))+lcm⁡(1,gcd⁡(1,3))+lcm⁡(2,gcd⁡(2,1))+lcm⁡(2,gcd⁡(1,2))+lcm⁡(3,gcd⁡(1,1))=lcm⁡(1,1)+lcm⁡(1,2)+lcm⁡(1,1)+lcm⁡(2,1)+lcm⁡(2,1)+lcm⁡(3,1)=1+2+1+2+2+3=11\operatorname{lcm}(1, \gcd(3, 1)) + \operatorname{lcm}(1, \gcd(2, 2)) + \operatorname{lcm}(1, \gcd(1, 3)) + \operatorname{lcm}(2, \gcd(2, 1)) + \operatorname{lcm}(2, \gcd(1, 2)) + \operatorname{lcm}(3, \gcd(1, 1)) = \operatorname{lcm}(1, 1) + \operatorname{lcm}(1, 2) + \operatorname{lcm}(1, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(3, 1) = 1 + 2 + 1 + 2 + 2 + 3 = 11

在第一个例子中,只有一个合适的三元组 (1,1,1)(1, 1, 1)。因此答案为 lcm⁡(1,gcd⁡(1,1))=lcm⁡(1,1)=1\operatorname{lcm}(1, \gcd(1, 1)) = \operatorname{lcm}(1, 1) = 1。

在第二个例子中,
lcm⁡(1,gcd⁡(3,1))+lcm⁡(1,gcd⁡(2,2))+lcm⁡(1,gcd⁡(1,3))+lcm⁡(2,gcd⁡(2,1))+lcm⁡(2,gcd⁡(1,2))+lcm⁡(3,gcd⁡(1,1))=lcm⁡(1,1)+lcm⁡(1,2)+lcm⁡(1,1)+lcm⁡(2,1)+lcm⁡(2,1)+lcm⁡(3,1)=1+2+1+2+2+3=11\operatorname{lcm}(1, \gcd(3, 1)) + \operatorname{lcm}(1, \gcd(2, 2)) + \operatorname{lcm}(1, \gcd(1, 3)) + \operatorname{lcm}(2, \gcd(2, 1)) + \operatorname{lcm}(2, \gcd(1, 2)) + \operatorname{lcm}(3, \gcd(1, 1)) = \operatorname{lcm}(1, 1) + \operatorname{lcm}(1, 2) + \operatorname{lcm}(1, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(2, 1) + \operatorname{lcm}(3, 1) = 1 + 2 + 1 + 2 + 2 + 3 = 11

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

首页