fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int D, a, b;
  8. cin >> D;
  9. for (int i=0; i<D; i++)
  10. {
  11. cin >> a >> b;
  12. if (b==0)
  13. cout << "1"<<endl;
  14. else
  15. {
  16. int x=1;
  17. x=pow(a,b);
  18. cout << x%10<<endl;
  19. }
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4472KB
stdin
Standard input is empty
stdout
Standard output is empty