Java BigInteger mod 1000000007 -
So I've written a Java code that can find the N'th Fibonacci number. My problem is, I have to answer the answer% 1000000007. I thought I could just write it to
System.out.println (AnswerMod (1000000007)); But this does not allow me to do this, and I get an error "Legal method is not applicable for BigInteger arguments (int) in BigInteger"
Can someone help me, this is my code.
import java.io.IOException; Import java.math.BigDecimal; Import java.math.BigInteger; Import java.util.Scanner; Public class dmoj {public static zero main (string [] args throws IOException {scanner scan = new scanner (System.in); BigDecall D, V, T, A; Bigentier B; Int index Int n = scan.nextInt (); Double phi1 = (1 + montey. Sqrt (5)) / 2; Double phi2 = (1 - montey. Sqrt (5)) / 2; Double sqrt = Math.sqrt (5); D = new wildcard (fi1); V = newest bit (F2); A = new business (sqrt); D = D. Pow (n); V = v.pow (n); T = d. Subract (V); T = t.divide (A); B = ttbigentengar (); Println (b.mod (+1000000007)); // I get an error here}
You have to pass BigIntega:
println (answer.mod (BigInteger.valueOf (+1000000007));
Comments
Post a Comment