Describe
as a sports Commissioner, C June is responsible for the training of the honor guard. Guard of Honor is composed of students of N * N Square, in order to ensure that the team in the March uniform, C June will follow the guard of honor left behind, according to his line of sight and the number of students to determine whether the team is neat. Now, C-June wants you to tell him the number of students you can see when the team is neat.
Analysis
- Analysis, if the point of C as (0, 0), then if the point (x, y) x, y coprime words, the point (x, y) must be seen.
- The problem translates to how to find the number of all coprime that are less than N.
- Euler functions
- But the Euler function sieve method is less than x and x coprime number, if (x, y) can be seen, then (y, X) can also be seen. So the result should be. But (1, 1)
- Also because C is used (0, 0), and (0, 1) and (1, 0) two points are not counted.
Code
bzoj-2190-Honor Guard-sdoi2008-Euler function