Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我给大家解释一下maoqi同学的程序思想(^_^)

Posted by zsl2007 at 2005-12-22 12:24:41 on Problem 1320
如果已知(n1,m1),(n2,m2)为方程t*n^2+1=m^2的两个整数解。(t为大于0的整数)  
那么 满足这样的(n,m)也是方程的解:
     n1*m2(+或-)n2*m1,m=m1*m2(+或-)t*n1*n2 

这个是我的程序:  只适合t=8的情况
  #include<stdio.h>
#include<math.h>
int main()
{
	int i;
	long long res[11];
	res[1]=6;res[2]=35;
    for(i=3;i<=10;i++)
     res[i]=(res[i-1]*res[i-1]-1)/res[i-2];
     for(i=1;i<=10;i++)
      printf("%10ld%10ld\n",(long)res[i],(long)(sqrt(8*res[i]*res[i]+1)-1)/2);	 
	  return 0;
	}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator