fork download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. signed long long d, a[10], b[10], z, y;
  8.  
  9. int main()
  10. {
  11. cin >> d;
  12. for(int i=0; d>i; i++)
  13. {
  14. cout << "" << endl;
  15. cin >> a[i] >> b[i];
  16. }
  17. for(int i=0; d>i; i++)
  18. {
  19. z=pow(a[i],b[i]);
  20. y=fmod(z,10);
  21. cout << y << endl;
  22. }
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 15240KB
stdin
2
2 3
3 3
stdout

8
7