import java.math.BigInteger;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
BigInteger [] f=new BigInteger[502];
f[1]=BigInteger.valueOf(1);
f[2]=BigInteger.valueOf(2);
for(int i=3;i<=501;i++)
{
f[i]=f[i-1].add(f[i-2]);
}
while(sc.hasNext())
{
int c=0;
BigInteger a=sc.nextBigInteger();
BigInteger b=sc.nextBigInteger();
if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ZERO)==0)
break;
else if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ZERO)==0)
System.out.println("1");
else if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ONE)==0)
System.out.println("1");
else if(a.compareTo(BigInteger.ONE)==0&&b.compareTo(BigInteger.ONE)==0)
System.out.println("1");
else
{
for(int i=1;i<501;i++)
{
if(f[i].compareTo(a)>=0&&f[i].compareTo(b)<=0)
c++;
}
System.out.println(c);
}
}
sc.close();
}
}
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
BigInteger [] f=new BigInteger[502];
f[1]=BigInteger.valueOf(1);
f[2]=BigInteger.valueOf(2);
for(int i=3;i<=501;i++)
{
f[i]=f[i-1].add(f[i-2]);
}
while(sc.hasNext())
{
int c=0;
BigInteger a=sc.nextBigInteger();
BigInteger b=sc.nextBigInteger();
if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ZERO)==0)
break;
else if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ZERO)==0)
System.out.println("1");
else if(a.compareTo(BigInteger.ZERO)==0&&b.compareTo(BigInteger.ONE)==0)
System.out.println("1");
else if(a.compareTo(BigInteger.ONE)==0&&b.compareTo(BigInteger.ONE)==0)
System.out.println("1");
else
{
for(int i=1;i<501;i++)
{
if(f[i].compareTo(a)>=0&&f[i].compareTo(b)<=0)
c++;
}
System.out.println(c);
}
}
sc.close();
}
}
0 comments :
Post a Comment