1 n d v相当于给$a[x]+=v[\gcd(x,n)=d]$ \[\begin{eqnarray*}&&v[\gcd(x,n)=d]\\&=&v[\gcd(\frac{x}{d},\frac{n}{d})=1]\\&=&v\sum_{k|\gcd(\frac{x}{d},\frac{n}{d})}\mu(k)\\&=&\sum_{k|\frac{n}{d},dk|x}v\mu(k)\end{eqnarray*}\] 设$a[i]=\su…
GCD Array Time Limit: 11000/5500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 843 Accepted Submission(s): 205 Problem Description Teacher Mai finds that many problems about arithmetic function can be reduced to…
搬运题解Claris:1 n d v相当于给$a[x]+=v[\gcd(x,n)=d]$ $\begin{eqnarray*}&&v[\gcd(x,n)=d]\\&=&v[\gcd(\frac{x}{d},\frac{n}{d})=1]\\&=&v\sum_{k|\gcd(\frac{x}{d},\frac{n}{d})}\mu(k)\\&=&\sum_{k|\frac{n}{d},dk|x}v\mu(k)\end{eqnarray*}$设…
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem 10983 18765 Y 1036 [ZJOI2008]树的统计Count 5293 13132 Y 1588 [HNOI2002]营业额统计 5056 13607 1001 [BeiJing2006]狼抓兔子 4526 18386 Y 2002 [Hnoi2010]Bounce 弹飞绵羊 43…
D. Array GCD 题目连接: http://codeforces.com/contest/624/problem/D Description You are given array ai of length n. You may consecutively apply two operations to this array: remove some subsegment (continuous subsequence) of length m < n and pay for it m·…
Array GCD 最后的序列里肯定有a[1], a[1]-1, a[1]+1, a[n], a[n]-1, a[n]+1中的一个,枚举质因子, dp去check #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #de…