/* * 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…
E - (例题)欧拉函数求和 Crawling in process... Crawling failed Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Description A lattice point (x, y) in the first quadrant (x and y are integers greater than or equal to 0…
题目大意:求 \[\sum\limits_{i=2}^n\phi(i)\] 题解:利用与埃筛类似的操作,可在 \(O(nlogn)\) 时间求出结果. 代码如下 #include <cstdio> using namespace std; const int maxn=3010; int kase,n,phi[maxn]; int main(){ int T;scanf("%d",&T); while(T--){ scanf("%d",&…
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7450 Accepted: 4536 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…
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7094 Accepted: 4288 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…