#include<bits/stdc++.h> #define ll long long using namespace std; ; int vis[maxn]; int mu[maxn]; int prime[maxn]; ; int sum1[maxn]; int sum2[maxn]; void get_mu() { mu[]=; vis[]=; ;i<maxn;i++) { ; prime[++tot]=i; } ;j<=tot && i*prime[j]…
传送门:https://www.spoj.com/problems/VLATTICE/en/ 题意: 在三维坐标系下,你在点(0,0,0),看的范围是(n,n,n)以内,求你可以看见多少个点没有被遮挡 题解: 一条线上的点肯定是会被挡的 所以我们求的是\(gcd(x,y,z)==1\)的组数 我们设 \[ f(d):gcd(x,y,z)=d的对数\\ F(d):d|gcd(x,y,z)的对数\\ 由于F(d)为[n/d]*[n/d]*[n/d]\\ 所以反演可得\\ f(1)=mu[d]*[n/…
题意: 在一个三维空间中,已知(0,0,0)和(n,n,n),求从原点可以看见多少个点 思路: 如果要能看见,即两点之间没有点,所以gcd(a,b,c) = 1         /*来自kuangbin 利用推GCD(a,b)的方法,可以推出GCD(a,b,c) = 1的个数等于mu[i]*(n/i)*(n/i)*(n/i)的和 然而是从0点开始的,而我们只能从1开始计算,因为少了0周围的所有ans初始+3 对于A(0,0,1),所以在计算mu[i]*(n/i)*(n/i)*(n/i)时,我们忽…
Visible Lattice Points 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 from point Y iff no other lattice point lies on the segmen…
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 from point Y iff no other lat…
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…
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 from point Y iff no other lat…
Visible Lattice Points Time Limit:7000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description 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 co…
题目: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 题意 : 从(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…