Calculation 2-欧拉函数的运用】的更多相关文章

题目传送门 Calculation 2 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6114    Accepted Submission(s): 2499 Problem Description Given a positive integer N, your task is to calculate the sum of the…
题目 题意:求小于n并且 和n不互质的数的总和. 思路:求小于n并且与n互质的数的和为:n*phi[n]/2 . 若a和n互质,n-a必定也和n互质(a<n).也就是说num必定为偶数.其中互质的数成对存在.其和为n. 公式证明: 反证法:如果存在K!=1使gcd(n,n-i)=k,那么(n-i)%k==0而n%k=0那么必须保证i%k=0k是n的因子,如果i%k=0那么gcd(n,i)=k,矛盾出现; 所以先求出1……n-1 的和, 再用这个和 减去 上面公式求出来的值. 欧拉函数phi(m)…
Calculation 2 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Given a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is s…
题目链接 题意 : 求小于n的数中与n不互质的所有数字之和. 思路 : 欧拉函数求的是小于等于n的数中与n互质的数个数,这个题的话,先把所有的数字之和求出来,再减掉欧拉函数中所有质数之和(即为eular(n)*n/2),得到的就是最终结果,所以也是模板题一道. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h&g…
题面: 题解:欧拉函数的基础应用,再套个很 easy 的等差数列前 n 项和就成了. 啊,最近在补作业+准备月考+学数论,题就没怎么写,感觉菜得一匹>_< CSL加油加油~! 代码: #include<cstdio> #include<cmath> #define ll long long #define mod(a) ((a)>=MOD?(a)%MOD:(a)) using namespace std; ; ll N,sq,phi,n; int main(){…
Calculation 2 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description Given a positive integer N, your task is to calculate the sum of the positive integers less than N which are not coprime to N. A is sai…
Calculation 2 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2181    Accepted Submission(s): 920 Problem Description Given a positive integer N, your task is to calculate the sum of the positiv…
Calculation 2 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2982    Accepted Submission(s): 1231 Problem Description Given a positive integer N, your task is to calculate the sum of the posit…
GCD 题意:输入N,M(2<=N<=1000000000, 1<=M<=N), 设1<=X<=N,求使gcd(X,N)>=M的X的个数.  (文末有题) 知识点:   欧拉函数.http://www.cnblogs.com/shentr/p/5317442.html 题解一: 当M==1时,显然答案为N. 当M!=1.  X是N的因子的倍数是 gcd(X,N)>1 && X<=N 的充要条件.so  先把N素因子分解, N=     …
2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 2553  Solved: 1565[Submit][Status][Discuss] Description Longge的数学成绩非常好,并且他非常乐于挑战高难度的数学问题.现在问题来了:给定一个整数N,你需要求出∑gcd(i, N)(1<=i <=N). Input 一个整数,为N. Output 一个整数,为所求的答案. Sample Inp…