Relatives Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11422 Accepted: 5571 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 there ar…
题目: The Euler function Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 166 Accepted Submission(s): 96 Problem Description The Euler function phi is an important kind of function in number theory…
题目大意: 给定m n p 求下式 题解:https://blog.csdn.net/codeswarrior/article/details/81700226 莫比乌斯讲解:https://www.cnblogs.com/peng-ym/p/8647856.html 莫比乌斯的mu[]:https://www.cnblogs.com/cjyyb/p/7953803.html #include <bits/stdc++.h> using namespace std; #define LL…
Description Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000). Input There are multiply testcases. Each testcase, there is one line contains three integers A, B and C, separated by a sin…
Reflect Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 288 Accepted Submission(s): 174 Problem Description We send a light from one point on a mirror material circle,it reflects N times and…
O(n) 筛选素数 #include<bits/stdc++.h> using namespace std; const int M = 1e6 + 10 ; int mindiv[M] ;//每个数的最小质因数 int prim[M] , pnum ;//存素数 bool vis[M] ; void prim () { for (int i = 2 ; i < M ; i ++) { if (!vis[i]) { mindiv[i] = i ; prim[ pnum++ ] = i ;…
题目 Source http://www.lightoj.com/volume_showproblem.php?problem=1298 Description A number is Almost-K-Prime if it has exactly K prime numbers (not necessarily distinct) in its prime factorization. For example, 12 = 2 * 2 * 3 is an Almost-3-Prime and…
2^x mod n = 1 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9231 Accepted Submission(s): 2837 Problem Description Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1. In…
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…