「CF757E」 Bash Plays with Functions 题意 设ω(n)ω(n) 表示nn 的质因子个数,定义 fr(n)={∑p⋅q=n[gcd(p,q)=1],r=0∑u⋅v=nfr−1(u)+fr−1(v)2,r≥1fr(n)=⎩⎨⎧p⋅q=n∑[gcd(p,q)=1],u⋅v=n∑2fr−1(u)+fr−1(v),r=0r≥1 给出qq 个r,...
757E. Bash Plays with Functions 题意:定义函数 f0(n)=∑u∗v=n[gcd(u,v)=1]f0(n)=∑u∗v=n[gcd(u,v)=1] fr+1(n)=∑u∗v=nfr(u)+fr(v)2fr+1(n)=∑u∗v=nfr(u)+fr(v)2 给定qq 次询问,每次询问给出 r,nr,n,输出 fr(n)fr(n) 答案对 1e9+71e9+7 取模 解法:积...
using namespace std;constintMAXN=1e6+10,INF=1e9+10,mod=1e9+7;inline intread(){char c=getchar();int x=0,f=1;while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();returnx*f;}int prime[MAXN],tot,vis[MAXN];L...
$q$组询问, 求$f_r(n)$的值模1e9+7. 显然可以得到$f_0(n)=2^{\omega(n)}$, 是积性函数. 所以$f_r=f_{r-1}*1$也为积性函数, 然后积性函数$dp$即可. 问题就转化为对每个素数$p$, 求$dp[p][r][k]=f_r(p^k)$. $dp[p][r][k]=\sum\limits_{x=0}^k dp[p][r-1][x]...
[数论]Codeforces 757E. Bash Plays with Functions Description f0(n)fr+1==∑uv=n[(u,v)=1]1∗fr求fr(n)。 Solution 因为n的所有质因子之间对f0(n)贡献是独立的,所以f0是个积性函数。 那么就有所有fr都是积性函数。 将每个质因子单独考虑,狄利克雷卷积的形式就可以化成简单的求和(可能就是普通...
757E. Bash Plays with Functions 题意:定义函数 \[f_0(n) = \sum_{u * v =n} [gcd(u, v) = 1]\] \[f_{r + 1}(n) = \sum_{u*v = n} \frac{f_r(u) + f_r(v)}{2}\] 给定\(q\) 次询问,每次询问给出 \(r,n\),输出 \(f_r(n)\) 答案对 \(1e9...
CF 757 E Bash Plays with Functions —— 积性函数与质因数分解,题目:http://codeforces.com/contest/757/problem/E首先,f0(n)=2m,其中m是n的质因数的种类数;而且因为这个函数和1卷积,所以是一个积性函数,就可以每个质因子单独考虑;而f0(pq)=2,对于每个质因子都一
Adding any Comment in any program plays a vital role. It means the shell script will ignore that command or line. Example: #This is my first script Shell Variables Variables are those to store data in terms of characters and numbers. Similarly, shell variables store information a user provide...
First, we wrapped the variable containing the string with the curly brackets and preceded the#operator with the variable. The#operator plays an essential role in printing the length of the string. If#is not used, the code will print the whole string, so adding it to the variable is essenti...
# Provide common setup and teardown functions, but do not name them such! # That way individual tests can override with their own setup/teardown, # while retaining the ability to include these if they so desire.# Setup helper: establish a test environment with exactly the images nee...