0_0_12663689_10485\Main.java:1: 进行语法解析时已到达文件结尾
import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int a, b; int n; while (in.hasNext()) { a = in.nextInt(); b = in.nextInt(); n = in.nextInt(); // 1 <= A, B <= 1000, 1 <= n <= 100,000,000 if (a < 1 && a > 1000 && b < 1 && b > 1000 && b < 1 && a > 100000000) System.exit(0); if (a == 0 & b == 0 & n == 0) System.exit(0); BigInteger f[] = new BigInteger[n]; f[0] = BigInteger.valueOf(1); f[1] = BigInteger.valueOf(1); for (int i = 2; i < f.length; i++) { f[i] = (f[i - 1].multiply(BigInteger.valueOf(a)).add(f[i - 2] .multiply(BigInteger.valueOf(b)))).remainder(BigInteger .valueOf(7)); //f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. } System.out.println(f[n - 1]); } }}
|