fork(2) download
  1. import java.util.Scanner;
  2. public class Main{
  3. public static void main(String[] args) throws java.lang.Exception {
  4. Scanner input = new Scanner(System.in);
  5. // System.out.println("Insert number of cases (between 1 and 10): ");
  6. int numberOfCases = input.nextInt();
  7. BigInteger[][] arrayOfNumbers = new BigInteger[numberOfCases][2];
  8. BigInteger[] result = new BigInteger[numberOfCases];
  9. String[] lastDigit = new String[numberOfCases];
  10. // int numberOfCases = 2;
  11. // BigInteger[][] arrayOfNumbers = {{BigInteger.valueOf(2),BigInteger.valueOf(2)},{BigInteger.valueOf(4),BigInteger.valueOf(4)}};
  12.  
  13. for (int i = 0; i < arrayOfNumbers.length; i++) {
  14. // System.out.println("Insert two numbers (between 1 and 1 000 000 000): ");
  15. for (int j = 0; j < arrayOfNumbers[i].length; j++) {
  16. arrayOfNumbers[i][j] = input.nextBigInteger();
  17. }
  18. }
  19.  
  20. // System.out.println("Last digits of results");
  21. for (int i = 0; i < arrayOfNumbers.length; i++) {
  22. result[i] = BigInteger.valueOf(1);
  23. BigInteger base = arrayOfNumbers[i][0];
  24. BigInteger index = arrayOfNumbers[i][1];
  25. for (BigInteger bi = BigInteger.valueOf(1); bi.compareTo(index) <= 0; bi = bi.add(BigInteger.ONE)) {
  26. result[i] = result[i].multiply(base);
  27. }
  28. lastDigit[i] = String.valueOf(result[i]);
  29. char charArray[] = lastDigit[i].toCharArray();
  30. for (int l = 0; l < charArray.length; l++) {
  31. if (l == ((charArray.length) - 1)) {
  32. System.out.println(charArray[l]);
  33. // System.out.printf("%d %s \n", result[i], charArray[l]);
  34. }
  35. }
  36. }
  37. }
  38. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1
999999999 999999999
compilation info
Main.java:7: error: cannot find symbol
        BigInteger[][] arrayOfNumbers = new BigInteger[numberOfCases][2];
        ^
  symbol:   class BigInteger
  location: class Main
Main.java:7: error: cannot find symbol
        BigInteger[][] arrayOfNumbers = new BigInteger[numberOfCases][2];
                                            ^
  symbol:   class BigInteger
  location: class Main
Main.java:8: error: cannot find symbol
        BigInteger[] result = new BigInteger[numberOfCases];
        ^
  symbol:   class BigInteger
  location: class Main
Main.java:8: error: cannot find symbol
        BigInteger[] result = new BigInteger[numberOfCases];
                                  ^
  symbol:   class BigInteger
  location: class Main
Main.java:22: error: cannot find symbol
            result[i] = BigInteger.valueOf(1);
                        ^
  symbol:   variable BigInteger
  location: class Main
Main.java:23: error: cannot find symbol
            BigInteger base = arrayOfNumbers[i][0];
            ^
  symbol:   class BigInteger
  location: class Main
Main.java:24: error: cannot find symbol
            BigInteger index = arrayOfNumbers[i][1];
            ^
  symbol:   class BigInteger
  location: class Main
Main.java:25: error: cannot find symbol
            for (BigInteger bi = BigInteger.valueOf(1); bi.compareTo(index) <= 0; bi = bi.add(BigInteger.ONE)) {
                 ^
  symbol:   class BigInteger
  location: class Main
Main.java:25: error: cannot find symbol
            for (BigInteger bi = BigInteger.valueOf(1); bi.compareTo(index) <= 0; bi = bi.add(BigInteger.ONE)) {
                                 ^
  symbol:   variable BigInteger
  location: class Main
Main.java:25: error: cannot find symbol
            for (BigInteger bi = BigInteger.valueOf(1); bi.compareTo(index) <= 0; bi = bi.add(BigInteger.ONE)) {
                                                                                              ^
  symbol:   variable BigInteger
  location: class Main
10 errors
stdout
Standard output is empty