zoukankan      html  css  js  c++  java
  • 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
    ",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
    ",yy,(xx-1)/2);
    		xt=xx; yt=yy;
    	}
    	return 0;
    }
    

      

  • 相关阅读:
    补码原理
    清风徐来,水波不兴
    月尾和周尾
    又一春又一季
    9.11
    晨光无限
    9.18
    心悠
    小事一桩
    一周岁啦
  • 原文地址:https://www.cnblogs.com/jie-dcai/p/3956822.html
Copyright © 2011-2022 走看看