1.

/**
 * FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
 * 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 Stefan Gohlke
 * @version 1.0, 12/09/2009
 *
 * Method : Ad-Hoc
 * Status : Accepted
 * Runtime: 0.264
 */

package howManyFibs_acc;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    
    public static void main (String[] args)
    {    
        howManyFiby();
    }

    public static void howManyFiby()
    {
        Scanner scanner = new Scanner(System.in);
        int groesse = 1000;
        BigInteger[] fibfolge = new BigInteger[groesse];
        
        fibfolge[0] = new BigInteger("1");
        fibfolge[1] = new BigInteger("2");
        
        for (int i=2; i< groesse; i++) {
            fibfolge[i] = fibfolge[i-1].add(fibfolge[i-2]);
        }
            
        while(scanner.hasNextBigInteger())
        {
                int counter = 0;
                BigInteger untergrenze = scanner.nextBigInteger();
                BigInteger obergrenze = scanner.nextBigInteger();
                
                if (untergrenze.compareTo(BigInteger.ZERO) == 0 && obergrenze.compareTo(BigInteger.ZERO)== 0) break;
                
                for (int i =0; i< groesse; i++) {
                    if (fibfolge[i].compareTo(untergrenze) >= 0 && fibfolge[i].compareTo(obergrenze) <= 0) counter++;
                }
                
                System.out.println(counter);
        }
    }
}

2.

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* 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 Dennis Wilfert
* @version 1.0, 12/09/2009
*
* Status : Accepted
* Runtime: 0.188
*/
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;


class Main {

// Vorberechnete fibonacci-Zahlen
static BigInteger[] fib = new BigInteger[5000];

public static void main(String[] args) throws IOException {

// Die ersten 5000 Fibonacci-Zahlen vorberechnen
fibonacci(5000);

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));
StringTokenizer token = new StringTokenizer(reader.readLine());

BigInteger a = new BigInteger(token.nextToken());
BigInteger b = new BigInteger(token.nextToken());
int i, count;
while(a.signum() != 0 || b.signum() != 0){

i = 0;
count = 0;
// Die erste Fibonacci-Zahl suchen die >=a ist
while(fib[i].compareTo(a) == -1){
i++;
}
// Zahlen zählen bis sie größer als b sind
while(fib[i].compareTo(b) != 1){
count++;
i++;

}

// Anzahl ausgeben
writer.println(count);

token = new StringTokenizer(reader.readLine());

a = new BigInteger(token.nextToken());
b = new BigInteger(token.nextToken());
}
writer.flush();


}

static BigInteger current;
static BigInteger previous;
static BigInteger result;
private static BigInteger fibonacci(int n) {

current = BigInteger.ONE;
previous = BigInteger.ZERO;
result = null;
for (int i = 2; i <= n; i++) {
result = current.add(previous);
previous = current;
current = result;
fib[i-2] = result;
}
return result;
}
}