-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path10183.java
More file actions
35 lines (34 loc) · 969 Bytes
/
10183.java
File metadata and controls
35 lines (34 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.math.BigInteger;
import java.util.Scanner;
public class Main{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
BigInteger f[] = new BigInteger[1000];
int i;
f[1] = BigInteger.ONE;
f[2] = new BigInteger("2");
BigInteger comp = BigInteger.valueOf(10).pow(100);
for(i=3; ; i++)
{
f[i] = f[i-1].add(f[i-2]);
if(f[i].compareTo(comp) > 0)break;
}
BigInteger a, b;
int cnt;
while(true)
{
a = in.nextBigInteger();
b = in.nextBigInteger();
if(a.compareTo(BigInteger.ZERO)==0 && b.compareTo(BigInteger.ZERO)==0)break;
cnt = 0;
for(i=1; ; i++)
{
if(f[i].compareTo(b)>0)break;
if( f[i].compareTo(a)>-1 )
cnt++;
}
System.out.println(cnt);
}
}
}