hdu 1316
import java.math.BigInteger; import java.util.Scanner; public class hdu1316 { public static void main(String[] args) { Scanner cin=new Scanner(System.in); BigInteger arr[]=new BigInteger[600]; BigInteger a,b;int i; arr[1]=BigInteger.valueOf(1); arr[2]=BigInteger.valueOf(2); for(i=3;i<600;i++) arr[i]=arr[i-1].add(arr[i-2]); while(cin.hasNextBigInteger()) { a=cin.nextBigInteger(); b=cin.nextBigInteger(); if((a.compareTo(BigInteger.ZERO)==0)&&(b.compareTo(BigInteger.ZERO)==0)) break; int count=0; for(i=1;i<600;i++) { if(arr[i].compareTo(b)>0) break; if(arr[i].compareTo(a)>=0&&arr[i].compareTo(b)<=0) count++; } System.out.println(count); } } }
posted on 2011-05-10 08:44 more think, more gains 阅读(194) 评论(0) 编辑 收藏 举报