HBC52117H.年轻人要热爱运动,模拟Function题解

冷默言语 算法基础篇 55 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
CSL likes to study various functions. Recently, he became fascinated with a new function. He named it cslcsl csl function. Its expression is as follows: csl(p,x)=3logpx+1csl(p,x) = 3log_{p}x + 1csl(p,x)=3logpx+1 Where p is a prime number. But CSL doesn't like floating point numbers and even numbers, nevertheless, he likes square numbers very much, so he decided to add some restrictions to his cslcsl csl functions: 1.if csl(p,x)csl(p,x) csl(p,x) is not integer,then let csl(p,x)=0csl(p,x)=0 csl(p,x)=0 2.if csl(p,x) is integer,but p is 2 or p can't be expressed as the sum of two squares,then let csl(p,x)=1csl(p,x)=1 csl(p,x)=1 TL saw the function of CSL. He thought it was not interesting enough, so he also defined a tltl tl function: tl(p,x)=maxd∣xtl(p,x)=max_{d|x}tl(p,x)=maxd∣x Where p is a prime number too. TL asked CSL proudly: I will give you an x, Could you calculate ∑d∣x∏ptl(p,d)sum_{d|x}prod_{p}tl(p,d)∑d∣x∏ptl(p,d) ?CSL thought about it and told TL the answer quickly. and he asked TL:so if I give you a n , Could you calculate ∑d=1n∏ptl(p,d)sum_{d=1}^{n}prod_{p}tl(p,d)∑d=1n∏ptl(p,d) ?

CSL likes to study various functions. Recently, he became fascinated with a new function. He named it csl csl csl  function. Its expression is as follows: csl(p,x)=3logpx+1csl(p,x) = 3log_{p}x + 1csl(p,x)=3logp​x+1 Where p is a prime number. But CSL doesn't like floating point numbers and even numbers, nevertheless, he likes square numbers very much, so he decided to add some restrictions to his csl csl csl  functions: 1.if csl(p,x) csl(p,x) csl(p,x)  is not integer,then let csl(p,x)=0 csl(p,x)=0 csl(p,x)=0  2.if csl(p,x) is integer,but p is 2 or p can't be expressed as the sum of two squares(which means: ∄a,b∈N+,s.t. a2+b2=pnexists a,b in N^+,s.t. a^2+b^2=p∄a,b∈N+,s.t. a2+b2=p),then let csl(p,x)=1 csl(p,x)=1 csl(p,x)=1  TL saw the function of CSL. He thought it was not interesting enough, so he also defined a tl tl tl  function: tl(p,x)=maxd∣x(csl(p,d))tl(p,x)=max_{d|x}(csl(p,d))tl(p,x)=maxd∣x​(csl(p,d)) Where p is a prime number too. TL asked CSL proudly: I will give you an x, Could you calculate ∑d∣x∏ptl(p,d)sum_{d|x}prod_{p}tl(p,d)∑d∣x​∏p​tl(p,d) (in which p passing through all the prime numbers)? CSL thought about it and told TL the answer quickly. and he asked TL:so if I give you a n , Could you calculate ∑d=1n∏ptl(p,d)sum_{d=1}^{n}prod_{p}tl(p,d)∑d=1n​∏p​tl(p,d) ? TL can't do this, so he turned up to you for help.

HBC52117H.年轻人要热爱运动,模拟Function题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC52117H.年轻人要热爱运动 模拟Function题解