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

Re:请问这题如何用Euler函数?

Posted by wywcgs at 2006-11-26 16:33:09 on Problem 3090
In Reply To:请问这题如何用Euler函数? Posted by:angela624 at 2006-11-26 16:22:28
先画一条(0, 0)到(n, n)的线,把图分成两部分,两部分是对称的,只需算一部分就好。
取右下半,这一半里的点(x, y)满足x >= y
可以通过欧拉函数计算第k列有多少点能够连到(0, 0)
若x与k的最大公约数d > 1,则(0, 0)与(x, k)点的脸先必定会通过(x/d, k/d),就被挡住了
所以能连的线的数目就是比k小的、和k互质的数的个数,然后就是欧拉函数。

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