A Simple Math Problem(https://acs.jxnu.edu.cn/problem/ICPCJX2020A)

这是一个关于计算数学问题的挑战。给定一个整数n,需要求出所有1到n中,互质数对(i, j)的F(j)之和,其中F(x)表示x的数字之和。例如,F(123)=6,F(700)=7。题目要求计算∑i=1n∑j=1i[gcd(j,i)=1]F(j),并给出当n=3时,答案为5。
摘要由CSDN通过智能技术生成

题目:

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.

For example: F(123)=1+2+3=6F(123)=1+2+3=6F(700)=7+0+0=7F(700)=7+0+0=7.

Huanhuan wants you to calculate the sum of F(j) for every i,j that satisfy 1≤jin and i,j are coprime.

More formally, calculate i=1nj=1i[gcd(j,i)=1]F(j)

输入:

There are only one test case with a single integer n(1≤n≤105)

输出:

Print one integer, the answer of i=1nj=1i[gcd(j,i)=1]F(j)

样例输入:

3

样例输出:

5

翻译:

描述:

欢欢向你挑战一个简单的数学问题。将 F(x) 定义为 x 的小数位数之和。

例如:F(123)=1+2+3=6F(700)=7+0+0=7.

欢欢想让你计算出对于每一个i,j F(j)的总和,满足1≤jin i,j互质。更正式地说,计算i=1nj=1i[gcd(j,i)=1]F(j)

输入:

仅一个测试用例,一个整数n(1≤n≤105)

输出:

输出一个整数, 问题i=1nj=1i[gcd(j,i)=1]F(j)的答案。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值