Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number that you cannot pay. Inp…
题意:求互质的m和n的最大不能组合数和不能组合数的个数 思路:m和n的最大不能组合数为m*n-m-n,不能组合数的个数为(m-1)*(n-1)/2 推导: 先讨论最大不能组合数 因为gcd(m,n)=1,所以 0,n,2*n,3*n,...(m-1)*n(共m个数字)分别除以m,余数肯定不同,且为{0,1,2,3...m-1}中的某数 若存在非负数p,q使得pm+qn=x,x为可组合值,两边对m取余,则(q*n)%m==x%m,p*m>=0,所以只要x>q*n,x都能被组合出来.当q<m…
Problem Description Given two positive integers a and b,find suitable X and Y to meet the conditions:                                                        X+Y=a                                              Least Common Multiple (X, Y) =b   InputInp…
传送门 •题意 一直整数$a,b$,有 $\left\{\begin{matrix}x+y=a\\ LCM(x*y)=b \end{matrix}\right.$ 求$x,y$ •思路 解题重点:若$gcd(p,q)=1$,则$gcd(p+q,pq)=1$ 设$gcd(x,y)=g$,令$p=\frac{x}{g},q=\frac{y}{g}$,$p,q$互素 则$\left\{\begin{matrix}x+y=p*g+q*g=(p+q)g=a\\ LCM(x,y)=\frac{xy}{g}=…
A New Change Problem Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Here you can assume that there are enough coins for both kinds.Please calculate the maximal value that you cannot pay and the total number tha…
HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 签到题,非常easy贪心得到答案是(sum + 1) / 2和ai最大值的最大值 代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N =…
HDU 5572 An Easy Physics Problem (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5572 Description On an infinite smooth table, there's a big round fixed cylinder and a little ball whose volume can be ignored. Currently the ball stands still at p…
A New Change Problem Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 533    Accepted Submission(s): 265 Problem Description Now given two kinds of coins A and B,which satisfy that GCD(A,B)=1.Her…
HDU 3861 The King's Problem 题目链接 题意:给定一个有向图,求最少划分成几个部分满足以下条件 互相可达的点必须分到一个集合 一个对点(u, v)必须至少有u可达v或者v可达u 一个点仅仅能分到一个集合 思路:先强连通缩点,然后二分图匹配求最小路径覆盖 代码: #include <cstdio> #include <cstring> #include <vector> #include <algorithm> #include &l…
给大一的排位赛中数论的一题.好吧不会做...提供一个题解吧:http://blog.csdn.net/aozil_yang/article/details/53538854. 又学了一个新的公式..如果x和y互质,那么x+y和x*y互质.证明如下:随便找一个x中有的因子c,因为x,y互质,因此c不是y的因子.同时c是x*y的因子,由同余模方程知(x+y)% c = x % c + y % c = 0 + y % c.因为c不是y的因子,所以不等于0,所以c不是x+y的因子.同理可以证得x和y中的…