POJ3090Visible Lattice Points】的更多相关文章

http://poj.org/problem?id=3090 对于此题,观测点的数目,从小规模开始观察,可以得到每一个点,由一根无限长的绳子,绕着原点旋转,得到的第一个点.换另外一个思路,每一个观察到的点,都是子矩阵的一个边界点,也就是说枚举每一个子矩阵的点即可,而对于重合的点,则是已经出现的点,也就是可以约分的点,斜率可以看出.那么也就是欧拉函数,通过线性筛欧拉函数,然后对于每一个询问,直接计算欧拉函数和即可.因为是对称的,所以只要求一半,后面再乘2+加上k=1的那一个就可以了 1 #incl…
Visible Lattice Points Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5636   Accepted: 3317 Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible fr…
SPOJ Problem Set (classical) 7001. Visible Lattice Points Problem code: VLATTICE Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from corner at (0,0,0) ? A point X is visible…
http://poj.org/problem?id=3090 Visible Lattice Points Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6153   Accepted: 3662 Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other…
题目:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=37193   Visible Lattice Points Time Limit: 1368MS   Memory Limit: 1572864KB   64bit IO Format: %lld & %llu Submit Status Description Consider a N*N*N lattice. One corner is at (0,0,0) and…
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5653 Accepted: 3331 Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from t…
P8 Visible Lattice Points Time Limit:1000ms,     Memory Limit:65536KB Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0…
Visible Lattice Points Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7705   Accepted: 4707 Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0), other than the origin, is visible fr…
/* * POJ3090 Visible Lattice Points * 欧拉函数 */ #include<cstdio> using namespace std; int C,N; //欧拉函数模板 int Euler(int n) { int num = n; for(int i = 2;i <= n;i++) { if(n % i == 0) { num = num / i * (i-1); } while(n % i == 0) { n /= i; } } return num…
Visible Lattice Points 题意 : 从(0,0,0)出发在(N,N,N)范围内有多少条不从重合的直线:我们只要求gcd(x,y,z) = 1; 的点有多少个就可以了: 比如 : 点(2,4,6)可以等价成(1,2,3)即经过(1,2,3)的线一定经过(2,4,6): 莫比乌斯反演的模板题, 由于点坐标可以为0 , 需要考虑 x, y, z 中两个为0 和一个为0 的情况 : 两个为0 时 : 有 三个点(在x , y, z 轴上): 一个为0 时 : mu[i] * (n/i…