fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main(String[] args) {
  11. Scanner odczyt = new Scanner(System.in);
  12.  
  13. int D,a,b;
  14. D = odczyt.nextInt();
  15. double[] tablica = new double[D];
  16.  
  17. for (int i=0; i<D; i++){
  18. a = odczyt.nextInt();
  19. b = odczyt.nextInt();
  20. tablica[i] = Math.round(Math.pow(a,b)%10);
  21. }
  22. for (int i=0; i<D; i++){
  23. System.out.println(Math.round(tablica[i]));
  24. }
  25. }
  26. }
Success #stdin #stdout 0.1s 380672KB
stdin
2
2 3
3 3
stdout
8
7