Heron and His Triangle HDU - 6222(pell 大数)
---恢复内容开始---
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
than or equal to n.
1
2
3
4
4
4
4
遇到求三角形面积且已知三边长 那就用海伦公式
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
than or equal to n.
1
2
3
4
4
4
4
首先根据题意设a=t-1,b=t,c=t+1,这样我们可由海伦凯勒公式得到
那么要想使得s为整数,就要使 等于3乘以一个平方数
所以我们设
于是得到 d=3
根据题意可知最小特解为x=2,y=1;
打个表之后发现这样一些数字4,14,52,194,724,2702....然后得出递推式子,F[n]=4*F[n-1]-F[n-2];由于n非常的大,所以矩阵快幂维护也不行。最后考虑这样的数字几乎增长比较快,那么范围内这样的数字就会比较少,不想用高精度的可以考虑用java大数了,用个list将所有n范围内的结果保存一下,最后直接查询就可以了。
Heron and His Triangle HDU - 6222(pell 大数)的更多相关文章
- Heron and His Triangle HDU - 6222
题目链接:https://vjudge.net/problem/HDU-6222 思路:打表找规律. 然后因为数据范围较大可以考虑用字符串模拟,或者__int128要注意用一个快读快输模板. 1 #i ...
- HDU 6222 Heron and His Triangle (pell 方程)
题面(本人翻译) A triangle is a Heron's triangle if it satisfies that the side lengths of it are consecutiv ...
- Heron and His Triangle 2017 沈阳区域赛
A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integer ...
- 2017 ACM/ICPC 沈阳 F题 Heron and his triangle
A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integer ...
- HDU 5047 Sawtooth(大数模拟)上海赛区网赛1006
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5047 解题报告:问一个“M”型可以把一个矩形的平面最多分割成多少块. 输入是有n个“M",现 ...
- HDU 1715 (大数相加,斐波拉契数列)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1715 大菲波数 Time Limit: 1000/1000 MS (Java/Others) ...
- hdu 5718(Oracle)大数加法
曾经有一位国王,统治着一片未名之地.他膝下有三个女儿. 三个女儿中最年轻漂亮的当属Psyche.她的父亲不确定她未来的命运,于是他来到Delphi神庙求神谕. 神谕可以看作一个不含前导零的正整数n n ...
- hdu 5351 规律+大数
题目大意:定义了一种fib字符串,问第n个fib串的前m个字母前后相等串的最大长度,大约就是这样的 其实主要读完题意的时候并没有思路,但是列几个fib字符串就会发现,除了fib1以外,所有串的前面都是 ...
- hdu 1063 Exponentiation 大数
Problem Description Problems involving the computation of exact values of very large magnitude and p ...
随机推荐
- 五、xadmin自定义插件2
以导入插件为例说明: 1.在xadmin-->plugins下面新建excel.py文件 2.新建ListExcelImportPlugin类,继承BaseAdminPlugin from xa ...
- Python-collections模块-57
返回顶部 模块的导入和使用 模块的导入应该在程序开始的地方 更多相关内容 http://www.cnblogs.com/Eva-J/articles/7292109.html 常用模块 colle ...
- Python-爬虫小例子-55
import re from urllib.request import urlopen def getPage(url): response = urlopen(url) return respon ...
- Yii框架的增删改查总结分析
一.查询数据 1.findAll(根据一个条件查询一个集合) $admin=Admin::model()->findAll($condition,$params); $admin=Admin:: ...
- 文本文档中各字母出现次数汇总(java)
package 字母频率统计; import java.io.*; public class Inputfile { public static void main(String args[]) { ...
- openstack-KVM-vCPU
一.KVM基础功能 (1)支持 硬件支持 VT-x VT-d 系统支持 kernel > 3.5 (2)计算机系统的子系统 CPU 处理器 Memory 内存 Storage 存储 Networ ...
- Eclipse支持文件UTF-8编码
Eclipse修改编码格式_百度经验https://jingyan.baidu.com/article/2009576193ee38cb0721b416.html 这篇最棒 如何为eclipse中的文 ...
- IdentityServer4【Introduction】之术语
术语 在规范.文档和对象模型中使用了一些你应该了解的术语. IdentityServer IdentityServer是一个OpenID Connect的提供者,它实现了OpenID Connect和 ...
- java 代理模式(静态代理、动态代理、Cglib代理) 转载
Java的三种代理模式 1.代理模式 代理(Proxy)是一种设计模式,提供了对目标对象另外的访问方式;即通过代理对象访问目标对象.这样做的好处是:可以在目标对象实现的基础上,增强额外的功能操作,即扩 ...
- Html5使用canvas作图线宽很粗
自己使用canvas画图是碰到的问题,在这里记录一下.我把lineWidth设置为1,但是很粗,而且发虚.代码如下: <script type="text/javascript&quo ...