Calculation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2272 Accepted Submission(s): 536 Problem Description Assume that f(0) = 1 and 0^0=1. f(n) = (n%10)^f(n/10) for all n bigger than ze…
Problem 1759 Super A^B mod C Time Limit: 1000 mSec Memory Limit : 32768 KB Problem 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. E…
Mathematician QSC Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Problem Description QSC dream of becoming a mathematician, he believes that everything in this world has a mathematical law. Through unremitting e…
题目描述 给定整数,求且为素数的数对有多少对. 分析 首先筛出所有的素数. 我们考虑枚举素数p,统计满足的个数,等价于统计的个数,即统计以内满足互质的有序数对个数. 不难发现,也就是说,我们只要预处理出欧拉函数,就可以在之内求出. 我们只需要用线性筛预处理出素数和欧拉函数,然后求,就可以在内解决问题. 代码 #include <cstdio> typedef long long lint; const int N=10000010; int n; int vis[N]; int pri[N];…