题面(本人翻译) 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…
---恢复内容开始--- Heron and His Triangle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2543    Accepted Submission(s): 1060 Problem Description A triangle is a Heron’s triangle if it satisfies th…
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…
一.Pell方程 形如x^2-dy^2=1的不定方程叫做Pell方程,其中d为正整数,则易得当d是完全平方数的时候这方程无正整数解,所以下面讨论d不是完全平方数的情况. 设Pell方程的最小正整数解为x0,y0则它的第n个正整数解满足xn+yn根号d=(x0+y0根号d)^n吧啦吧啦巴吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦吧啦拉巴拉巴拉,然后随便撸撸就撸出递推式子了……OI里一般都要求第n个解,所以先暴力出最小解,然后快速幂搞,,,,,,,,,,, ————————————————————…
hdu 3304 Interesting Yang Yui Triangle 题意: 给出P,N,问第N行的斐波那契数模P不等于0的有多少个? 限制: P < 1000,N <= 10^9 思路: lucas定理. 假设: n = a[k]*p^k + a[k-1]*p^(k-1) + ... + a[1]*p + a[0] m = b[k]*p^k + b[k-1]*p^(k-1) + ... + b[1]*p + b[0] 则: C(n,m) = pe(i=0~k,C(a[i],b[i])…
裸的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://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…
题目链接:https://vjudge.net/problem/HDU-6222 思路:打表找规律. 然后因为数据范围较大可以考虑用字符串模拟,或者__int128要注意用一个快读快输模板. 1 #include <bits/stdc++.h> 2 #include <time.h> 3 #include <set> 4 #include <map> 5 #include <stack> 6 #include <cmath> 7 #i…
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 than or equa…