hdu 5750(数论)】的更多相关文章

Dertouzos Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 891    Accepted Submission(s): 274 Problem Description A positive proper divisor is a positive divisor of a number n, excluding n itse…
Dertouzos Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1861    Accepted Submission(s): 584 Problem Description A positive proper divisor is a positive divisor of a number n, excluding n its…
GCD and LCM HDU 4497 数论 题意 给你三个数x,y,z的最大公约数G和最小公倍数L,问你三个数字一共有几种可能.注意123和321算两种情况. 解题思路 L代表LCM,G代表GCD. \[ x=(p_1^{i_1})*(p_2^{i_2})*(p_3^{i_3})\dots \] \[ y=(p_1^{j_1})*(p_2^{j_2})*(p_3^{j_3})\dots \] \[ z=(p_1^{k_1})*(p_2^{k_2})*(p_3^{k_3})\dots \] \…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4497 解题思路:将满足条件的一组x,z,y都除以G,得到x‘,y',z',满足条件gcd(x',y',x') = 1,同时lcm(x',y',x') = G/L. 特判,当G%L != 0 时,无解. 然后素数分解G/L,假设G/L = p1^t1 * p2^t2 *````* pn^tn. 满足上面条件的x,y,z一定为这样的形式. x' = p1^i1 * p2^i2 *```* pn^in.…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4542 小明系列故事--未知剩余系 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 889    Accepted Submission(s): 207 Problem Description "今有物不知其数,三三数之有二,五五数之有三,七七数之有…
http://acm.hdu.edu.cn/showproblem.php?pid=4961 给定ai数组; 构造bi, k=max(j | 0<j<i,a j%ai=0), bi=ak; 构造ci, k=min(j | i<j≤n,aj%ai=0), ci=ak; 求所有bi∗ci的和 f[x]表示能整除x的最近的下标,边构造边更新f数组,复杂度约为O(N*sqrt(A[I])) = O(10^7),可以接受,然后把所有b*c加起来即可 另外,我写的程序里面c[i]指的是上面说的b[i…
Different Digits Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1430    Accepted Submission(s): 392 Problem Description Given a positive integer n, your task is to find a positive integer m, w…
http://acm.hdu.edu.cn/showproblem.php?pid=3641 学到: 1.二分求符合条件的最小值 /*==================================================== 二分查找符合条件的最小值 ======================================================*/ ll solve() { __int64 low = 0, high = INF, mid ; while(low <=…
http://acm.hdu.edu.cn/showproblem.php? pid=4059 现场赛中通过率挺高的一道题 可是容斥原理不怎么会.. 參考了http://blog.csdn.net/acm_cxlove/article/details/7434864 1.求逆元   p=1e9+7是素数.所以由 a^(p-1)%p同余于1 可得a%p的逆元为a^(p-2) 2.segma(i^k)都能够通过推导得到求和公式 详见http://blog.csdn.net/acm_cxlove/ar…
题目给定n和d,都是10的9次方以内,求1到n里面有几个数最大因数是d?1000000组数据.解:求出d的满足p[i]*d<n的最小质因数是第几个质数.即为答案. #include<cstdio> #define N 100002 int t,n,d,pr[N],p[N],num; int main(){ for(int i=2;i<N;i++)if(!pr[i]){ for(int j=i+i;j<N;j+=i) pr[j]=1; p[++num]=i; } scanf(&…