当前位置:网站首页>(Codeforce 757) E. Bash Plays with Functions
(Codeforce 757) E. Bash Plays with Functions
2022-08-01 04:49:00 【AC__dream】
Title: 
Sample input:
50 301 253 652 54 48Sample output:
85254630Title: 
Let's analyze the situation of r=0 first, if we now find f0(n), n=p1^a1*p2^a2*...*pm^am
Then f0(n) is equal to 2^m, which is obvious, because we assume p=p1^b1*p2^b2*...*pm^bm, then for any bi (1<=i<=m) all have bi=0 or bi=ai, otherwise there will be no q such that p*q=n and gcd(p,q)=1, then it is not difficult for us to find that f0(x) is an integralfunction.Assuming that for n=p*q, gcd(p,q)=1, there will be no identical prime factors in the prime factorization of p and q. It may be assumed that p has i prime factors and q has j prime factors, thenp*q will have i+j prime factors, then f0(pq)=2^(i+j)=2^i*2^j=f0(p)*f0(q), so f0(x)is an integral function.
Below I use induction to prove that for any r, fr(x) is an integral function.

We know that for the case of r=0, the value of f0(n) is only related to the type of prime factor of n, not the specific prime factor.The case where r is not 0 is obtained from the case where r=0, so when r is not 0, it has nothing to do with the specific prime factor.We deduced above that fr(x) is an integral function for any r, so we only need to look at the prime factorization of n when we find fr(n), then the problem becomes to solve fr(p^i), p is a prime number, according to the formula we can find fr(p^i)=
, and because it has nothing to do with the specific prime factor, through the above formula we can find that it is only related to the number of prime factors, thenWe can let f[i][j] record the value of fi(p^j), since n is less than 1e6, so the highest number of prime factorization will not exceed 20, so that all numbers can be preprocessed through O(r*20).When r=0, according to its definition we can know that f[0][1]=1,f[0][i]=2(i>1), preprocess it
The rest is to record the number of prime factors for each group of queries, and directly use the property of the integral function to solve it.
Here is the code:
#include#include#include#include#include 边栏推荐
- ICML2022 | Deep Dive into Permutation-Sensitive Graph Neural Networks
- API设计笔记:pimpl技巧
- 项目风险管理必备内容总结
- PMP子过程定义总结
- Pyspark Machine Learning: Vectors and Common Operations
- 【愚公系列】2022年07月 Go教学课程 023-Go容器之列表
- Message queue design based on mysql
- 认真对待每一个时刻
- 深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
- 【云原生之kubernetes实战】kubernetes集群的检测工具——popeye
猜你喜欢

Mysql基础篇(约束)

Excel record of integer programming optimization model to solve the problem

FFmpeg 搭建本地屏幕录制环境

程序员代码面试指南 CD15 生成窗口最大值数组

认真对待每一个时刻

产品经理访谈 | 第五代验证码的创新与背景

IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints

56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)

typescript19-对象可选参数

mysql中解决存储过程表名通过变量传递的方法
随机推荐
6-23漏洞利用-postgresql代码执行利用
TIM登陆时提示00001(TIM00001)
safari浏览器怎么导入书签
typescript23-tuple
万字逐行解析与实现Transformer,并进行德译英实战(三)
PAT乙级 1001 害死人不偿命的(3n+1)猜想
出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
MySQL4
PMP 相关方管理必背总结
Excel做题记录——整数规划优化模型
状态压缩dp
ICML2022 | Deep Dive into Permutation-Sensitive Graph Neural Networks
PMP 项目沟通管理
PMP工具与技术总结
typescript25-类型断言
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
万字逐行解析与实现Transformer,并进行德译英实战(一)
数组问题之《下一个排列》、《旋转图像》以及二分查找之《搜索二维矩阵》
Error using ts-node
The method of solving stored procedure table name passing through variable in mysql