当前位置:网站首页>(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
边栏推荐
猜你喜欢
随机推荐
文件的异步读写
typescript26-字面量类型
Immutable
mysql中解决存储过程表名通过变量传递的方法
高数 | 【重积分】线面积分880例题
y83.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十四)
报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
6-23漏洞利用-postgresql代码执行利用
PMP工具与技术总结
状态压缩dp
typescript25 - type assertion
Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
怀念故乡的面条
Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
7月编程排行榜来啦!这次有何新变化?
阿叶的目标
RSA主要攻击方法
/etc/fstab
时时刻刻保持敬畏之心
请问shake数据库中为什么读取100个collection 后,直接就退出了,不继续读了呢?