题目链接 做过\(n\)遍这种题了... 答案就是\(\sum_{i=1}^{n}\sum_{j=1}^{n/i}[\varphi(j)*i]\) 线筛欧拉函数求前缀和直接算就行. #include <cstdio> const int MAXN = 2000010; int v[MAXN], prime[MAXN], cnt, n; long long ans, phi[MAXN]; int main(){ scanf("%d", &n); phi[1] = 1;…
Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11372 Accepted: 5544 Description Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if ther…
找新朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7001 Accepted Submission(s): 3643 Problem Description 新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数…
找新朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9361 Accepted Submission(s): 4955 Problem Description 新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数…
GCD Again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2611 Accepted Submission(s): 1090 Problem Description Do you have spent some time to think and try to solve those unsolved problem a…
找新朋友 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7651 Accepted Submission(s): 4033 Problem Description 新年快到了,"猪头帮协会"准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大…
GCD Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5454 Accepted Submission(s): 1957 Problem Description Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y…
GCD Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 3 Accepted Submission(s) : 2 Problem Description The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b…
找新朋友 Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 58 Accepted Submission(s) : 30 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description 新年快到了,"猪头帮协会"准备搞一个聚会,已经知道现有…