POJ 1320

作弊了--!该题可以通过因式分解得到一个佩尔方程。。。。要不是学着这章,估计想不到。。

得到x1,y1后,就直接代入递推式递推了

 

x[n]=x[n-1]*x[1]+d*y[n-1]*y[1]

y[n]=x[n-1]*y[1]+y[n-1]*x[1]

 

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
	int xt,yt,xx,yy;
	int x1=3,y1=1;
//	printf("%10d%10d\n",y1,(x1-1)/2);
	xt=x1; yt=y1;
	for(int i=1;i<=10;i++){
		xx=xt*3+8*yt;
		yy=xt+yt*3;
		printf("%10d%10d\n",yy,(xx-1)/2);
		xt=xx; yt=yy;
	}
	return 0;
}

  

posted @ 2014-09-04 20:33  chenjunjie1994  阅读(175)  评论(0编辑  收藏  举报