Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

可恶,谁说不超int64的-_-

Posted by Arios at 2009-07-20 11:21:09 on Problem 1091
我们有两种方法可以推导公式f(n,m)=m^n*∏(1-1/p^n)(p为m的素因子);
1.用容斥原理可以依次列出各项,最后化简得以上公式(化简的时候比较难看得出来);
2.利用积性函数证明:
  (1).当m=p^k时,易知f(n,p^k)=p^k^n-p^(k-1)^n;
  (2).当m=a*b且(a,b)==1时,我们有Σa[i]*x1[i]+a*x1[n+1]=1和Σb[i]*x2[i]+b*x2[n+1]=1,
      那么由中国剩余定理x1[],x2[]可以和x[]构成双射,从而有f(n,a*b)=f(n,a)*f(n,b);
  (3).由(1)(2)再根据素数唯一分解定理可得
      f(n,m)=∏(p[i]^(n*a[i])-p[i]^(n*(a[i]-1)))=m^n*∏(1-1/p[i]^n)。

容斥原理那种想法我也是看别人的,可是不管怎么样,就算以前的数据比较弱,知道公式后用脚趾头想都应该知道数据范围肯定超int64的啦-_-

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator