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

Misaki's Kiss again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1621    Accepted Submission(s): 414 Problem Description After the Ferries Wheel, many friends hope to receive the Misaki's kis…
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…
别人的解题报告: http://blog.csdn.net/zstu_zlj/article/details/9796087 我的代码: #include <cstdio> #define N 100020 ; int p[N]; void Partition() { p[] =; ; n <= 1e5; ++n) { ; ; while(true) { *k-)/; ) break; p[n] = (p[n]+fac*p[t])%mod; ) p[n] = (p[n]+fac*p[t-…
GT and numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1818    Accepted Submission(s): 490 Problem Description You are given two numbers N and M. Every step you can get a new N in the wa…