题目链接:http://www.spoj.com/problems/EQU2/ 题意:给出方程x^2-n*y^2=1的最小整数解. 思路:参见金斌大牛的论文<欧几里得算法的应用>. import java.util.*; import java.math.*; import java.io.*; public class Main { static BigInteger ONE=BigInteger.valueOf(1); static BigInteger ZERO=BigInteger.v…
一.Pell方程 形如x^2-dy^2=1的不定方程叫做Pell方程,其中d为正整数,则易得当d是完全平方数的时候这方程无正整数解,所以下面讨论d不是完全平方数的情况. 设Pell方程的最小正整数解为x0,y0则它的第n个正整数解满足xn+yn根号d=(x0+y0根号d)^n吧啦吧啦巴吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦拉巴拉巴拉,然后随便撸撸就撸出递推式子了……OI里一般都要求第n个解,所以先暴力出最小解,然后快速幂搞,,,,,,,,,,, ————————————————————…
裸的pell方程. 然后加个快速幂. No more tricks, Mr Nanguo Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 320    Accepted Submission(s): 207 Problem Description Now Sailormoon girls want to tell you a ancien…
http://acm.hdu.edu.cn/showproblem.php?pid=2281 又是一道Pell方程 化简构造以后的Pell方程为 求出其前15个解,但这些解不一定满足等式,判断后只有5个满足的情况,直接判断即可 求法可以参照上一篇日志: http://www.cnblogs.com/Felix-F/p/3223323.html struct matrix { LL ma[][]; }; ; LL nn[],xx[]; matrix operator * (matrix a,mat…
http://poj.org/problem?id=1320 题意很简单,有序列 1,2,3...(a-1),a,(a+1)...b  要使以a为分界的 前缀和 和 后缀和 相等 求a,b 因为序列很特殊所以我们用数学方法就可以解决 : 求和:  a*(a-1)/2 = (a+1+b)(b-a)/2 化简: 2a2  = b2 + b 两边乘4,构造完全平方项 (2b+1)2 - 8a2  = 1 令 x = 2*b+1; y = a; 我们就得到了一个形如Pell方程x2 - Dy2  = 1…
题目链接 :  http://poj.org/problem?id=2427 PELL方程几个学习的网址: http://mathworld.wolfram.com/PellEquation.html     wolfram的讲解 http://hi.baidu.com/aekdycoin/item/a45f7c37850e5b9db80c03d1     AC神的博客 http://blog.csdn.net/acdreamers/article/details/8529686    acdr…
题面(本人翻译) A triangle is a Heron's triangle if it satisfies that the side lengths of it are consecutive integers t - 1, t, t + 1 and thatits area is an integer. Now, for given n you need to find a Heron's triangle associated with the smallest t bigger…
Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient. If there is no solution for the equation, return "No solution". If th…
[转载请注明出处]http://www.cnblogs.com/mashiqi 2018/08/08 eikonal equation如下:$$|\nabla_x \tau (x)| = n(x).$$ 定义Hamiltonian:$H(p,x) = \tfrac 1 2 n^{-2}(x)|p|^2 - \tfrac 1 2$,于是可得$$0 = \textrm{d}H = \sum_j \frac{\partial H}{\partial p_j} \textrm{d}p_j + \sum_…
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 25633    Accepted Submission(s): 11018 Problem Description Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 ==…