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

计算 (2^(n+1)+1)%3

Posted by gemenhao at 2006-03-23 11:14:56 on Problem 2506
实际为 
  f(n) = f(n-1)+2*f(n-2)
得到
  f(n) = (2*2^n+(-1)^n)/3 = (2^(n+1)+1)%3  (why?)

  if(n<62)
 

快速计算上面的表达式,计算2的幂用移位快

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