标签:
JAVA大数....
10 100 1234567890 9876543210 0 0
5 4
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); final BigInteger maxlimit=BigInteger.TEN.pow(100); BigInteger[] fib=new BigInteger[500]; fib[0]=BigInteger.ONE; fib[1]=BigInteger.valueOf(2); for(int i=2;i<500;i++) { fib[i]=fib[i-1].add(fib[i-2]); } while(cin.hasNextBigInteger()) { BigInteger a=cin.nextBigInteger(); BigInteger b=cin.nextBigInteger(); if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ZERO)==0) break; int ans=0; for(int i=0;i<500;i++) { if(fib[i].compareTo(a)>=0&&fib[i].compareTo(b)<=0) ans++; } System.out.println(ans); } } }
标签:
原文地址:http://www.cnblogs.com/bhlsheji/p/5322992.html