https://acs.jxnu.edu.cn/problem/ICPCJX2020A
A Simple Math Problem
1000ms 131072K
描述:
Huanhuan challenges you to a simple math problem.
Define F(x)F(x) as the sum of the decimal digits of xx.
(欢欢对你做了一个简单数学问题的挑战。定义F(x)作为十进制数 x的和)
For example: F(123)=1+2+3=6F(123)=1+2+3=6, F(700)=7+0+0=7F(700)=7+0+0=7.
Huanhuan wants you to calculate the sum of F(j)F(j) for every i,ji,j that satisfy 1≤j≤i≤n and i,j are coprime.
More formally, calculate ∑i=1n∑j=1i[gcd(j,i)=1]F(j)∑i=1n∑j=1i[gcd(j,i)=1]F(j).(欢欢想要你去计算这个F(j)对于每个i的和,其中满足1≤j≤i≤n,而i,j又是互质的。计算∑i=1n∑j=1i[gcd(j,i)=1]F(j)∑i=1n∑j=1i[gcd(j,i)=1]F(j).)
输入:
There are only one test case with a single integer n(1≤n≤105)n(1≤n≤105).
(只有一个测试例子其为一个整数)
输出:
Print one integer, the answer of ∑i=1n∑j=1i[gcd(j,i)=1]F(j)∑i=1n∑j=1i[gcd(j,i)=1]F(j).
(输出一个整数作为答案)