1.

/**
* Angewandte Mathematik, SS11
* Problem: 10183 - How Many Fibs
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=13&page=show_problem&problem=1124
*
* @author Markus Schöllner
* @author Andreas Maier
* @version 1.0, 05/31/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.452
*/

import java.math.*;
import java.util.*;


public class Main {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);
BigInteger a;
BigInteger b;
int output=0;
BigInteger bigArray[] = new BigInteger[502];

a = input.nextBigInteger();
b = input.nextBigInteger();
boolean stop = (a.compareTo(BigInteger.ZERO)==0)&&(b.compareTo(BigInteger.ZERO)==0);
while(!stop){
for ( int c = 0; c < 500; c++ ) {
if(c==0 || c==1){
if(c ==0)bigArray[0] = BigInteger.ONE;
if(c==1) bigArray[1] = BigInteger.ONE.add(BigInteger.ONE);
}
else{
bigArray[c] = bigArray[c-1].add(bigArray[c-2]);
}
if(bigArray[c].compareTo(a)>=0){
if(bigArray[c].compareTo(b)<=0){
output++;
}
}
}
System.out.println(output);
output =0;
a = input.nextBigInteger();
b = input.nextBigInteger();
stop = (a.compareTo(BigInteger.ZERO)==0)&&(b.compareTo(BigInteger.ZERO)==0);
}
}
}
------------------------------------------


1.

/*
* ACM Contest training
* Problem: 10183 - How Many Fibs?
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1124
*
* @author Christoph Goettschkes
* @version 1.0, 01/06/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.212
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.math.BigInteger;

class Main {

static BigInteger[] fibs = new BigInteger[479];

public static void main(String[] args) throws Exception {
pre();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

StringTokenizer tokenizer = new StringTokenizer(reader.readLine());
BigInteger first = new BigInteger(tokenizer.nextToken());
BigInteger second = new BigInteger(tokenizer.nextToken());

while (first.compareTo(BigInteger.ZERO) != 0 || second.compareTo(BigInteger.ZERO) != 0) {
int counter = 0;
for (BigInteger cur : fibs) {
if (cur.compareTo(second) > 0)
break;
if (cur.compareTo(first) >= 0)
counter++;
}

System.out.println(counter);

tokenizer = new StringTokenizer(reader.readLine());
first = new BigInteger(tokenizer.nextToken());
second = new BigInteger(tokenizer.nextToken());
}
}

static void pre() {
BigInteger first = BigInteger.ONE;
BigInteger last = first.add(BigInteger.ONE);
BigInteger tmp;
BigInteger end = new BigInteger("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
int counter = 0;

while (true) {
fibs[counter] = first;
tmp = first;
first = last;
last = tmp.add(last);
if (first.compareTo(end) >= 0) {
break;
}
counter++;
}
}
}