当前位置:网站首页>(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 48
Sample output:
85254630
Title:
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
边栏推荐
- (2022牛客多校四)N-Particle Arts(思维)
- typescript27 - what about enumeration types
- Mysql基础篇(Mysql数据类型)
- Valentine's Day Romantic 3D Photo Wall [with source code]
- 剑指 Offer 68 - II. 二叉树的最近公共祖先
- typescript28 - value of enumeration type and data enumeration
- typescript21-接口和类型别名的对比
- Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
- UE4 rays flashed from mouse position detection
- "ArchSummit: The cry of the times, technical people can hear"
猜你喜欢
Pyspark Machine Learning: Vectors and Common Operations
Valentine's Day Romantic 3D Photo Wall [with source code]
初识shell脚本
【kali-信息收集】枚举——DNS枚举:DNSenum、fierce
How to promote new products online?
Difference Between Compiled and Interpreted Languages
typescript26 - literal types
最新 955 不加班的公司名单
UE4 从鼠标位置射出射线检测
程序员代码面试指南 CD15 生成窗口最大值数组
随机推荐
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
Visual Studio提供的 Command Prompt 到底有啥用
25. Have you been asked these three common interview questions?
阿叶的目标
「以云为核,无感极速」顶象第五代验证码
Progressive Reconstruction of Visual Structure for Image Inpainting 论文笔记
Invalid classes inferred from unique values of `y`. Expected: [0 1 2], got [1 2 3]
typescript28-枚举类型的值以及数据枚举
Risk strategy important steps of tuning method
高数 | 【重积分】线面积分880例题
How to promote new products online?
MySQL-数据定义语言-DDLdatebase define language
请问shake数据库中想把源的db0的数据同步到目的db5,参数怎么设置呢?
y83.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十四)
UE4 rays flashed from mouse position detection
Optional parameters typescript19 - object
typescript19-对象可选参数
mysql中解决存储过程表名通过变量传递的方法
UE4 从鼠标位置射出射线检测
scheduleWithFixedDelay和scheduleAtFixedRate的区别