POJ 1320 Street Numbers 解佩尔方程】的更多相关文章

传送门 Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2529   Accepted: 1406 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks…
任意门:http://poj.org/problem?id=1320 Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3181   Accepted: 1776 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the…
Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3078   Accepted: 1725 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her…
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=1320 题目大意: 求解两个不相等的正整数N.M(N<M),使得 1 + 2 + - + N = (N+1) + - + M.输出前10组满足要求 的(N,M). 思路: 要使 1 + 2 + - + N = (N+1) + - + M,那么 N*(N+1)/2 = (M-N)(M+N+1)/2,即 (2*M+1)^2 - 8*N^2 - 1.令x = 2*M + 1.y = N,就有x^2 - 8*y^2 = 1.就变成了典型的…
题意:求方程x2-Dy2=1的最小正整数解 思路:用连分数法解佩尔方程,关键是找出√d的连分数表示的循环节.具体过程参见:http://m.blog.csdn.net/blog/wh2124335/8871535 当d为完全平方数时无解 将√d表示成连分数的形式,例如: 当d不为完全平方数时,√d为无理数,那么√d总可以表示成: 记 当n为偶数时,x0=p,y0=q:当n为奇数时,x0=2p2+1,y0=2pq 求d在1000以内佩尔方程的最小正整数解的c++打表程序(正常跑比较慢,这个题需要离…
Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2753   Accepted: 1530 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her…
任意门:http://acm.hdu.edu.cn/showproblem.php?pid=3292 No more tricks, Mr Nanguo Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 587    Accepted Submission(s): 400 Problem Description Now Sailormoon…
#include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> using namespace std;   int can[1005] = {0}; int a[10005][605]= {0}; int x[6005], y[6005], t[6005]; int h1,h2; int bb, ee, xx, y…
//穷举法! /* ====================================================== 题目:求佩尔方程x*x-73*y*y=1的解. ====================================================== */ #include<stdio.h> #include<math.h> int main(void) { int x,y; double t; for(y=1;y<=10000000;y+…