UVA 10183 - How Many Fibs? UVA • Sep 1, 2020 Problem PDFSolution:package mypkg; import java.math.BigInteger; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner (System.in); BigInteger[] fib = new BigInteger[501]; fib[1] = BigInteger.valueOf(1); fib[2] = BigInteger.valueOf(2); for(int i = 3; i < 500; i++) fib[i] = fib[i-1].add(fib[i-2]); while(in.hasNext()) { BigInteger a=in.nextBigInteger(); BigInteger b=in.nextBigInteger(); int count=0; if(a.compareTo(BigInteger.ZERO)==0 && b.compareTo(BigInteger.ZERO)==0) break; else if(a.compareTo(BigInteger.ZERO)==0 && b.compareTo(BigInteger.ONE)==0) { System.out.println(1); continue; } else if(a.compareTo(BigInteger.ONE)==0 && b.compareTo(BigInteger.ONE)==0) { System.out.println(1); continue; } for(int i = 1;i<500;i++) { if(fib[i].compareTo(a) >= 0 && fib[i].compareTo(b) <= 0) count++; } System.out.println(count); } } } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10183/Main.java Tags UVA Competitive Programming Shipu Ahamed Recommended for you UVA UVA 913 - Joana and the Odd Numbers 4 years ago • 1 min read UVA UVA 871 - Counting Cells in a Blob 4 years ago • 3 min read UVA UVA 866 - Intersecting Line Segments 4 years ago • 3 min read