观察这个分子序列 设分子为b序列 ,分母为a 序列
则他们满足一下条件
a[i] = a[i - 1] * 2 + a[i - 2]
b[i] = b[i - 1] * 2+b[i - 2]
然后就发现需要高精度
import java.math.*;
import java.util.*;public class Main {/*** @param args*/public static void main(String[] args) {// TODO Auto-generated method stubBigInteger a[] = new BigInteger [1111];BigInteger b[] = new BigInteger [1111];a[0] = BigInteger.valueOf(1);b[0] = BigInteger.valueOf(1);a[1] = BigInteger.valueOf(2);b[1] = BigInteger.valueOf(3);for(int i = 2; i <= 1000; i++){a[i] = a[i - 1].multiply(BigInteger.valueOf(2)).add(a[i - 2]);b[i] = b[i - 1].multiply(BigInteger.valueOf(2)).add(b[i - 2]);}int ans = 0;for(int i = 2; i <= 1000; i++){if(b[i].toString().length() > a[i].toString().length()) ans++;}System.out.println(ans);}}