fork(1) download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. int a=0, b=0, d=0;
  7. std::cin >> d;
  8. int* tab = new int[d];
  9. for (int i = 0; i < d; i++)
  10. {
  11. std::cin >> a >> b;
  12. int c = pow(a, b);
  13. tab[i] = c % 10;
  14. }
  15. for (int i = 0; i < d; i++)
  16. {
  17. std::cout << tab[i] << "\n";
  18. }
  19. }
Success #stdin #stdout 0s 4496KB
stdin
2
2 3
3 3
stdout
8
7