fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int t;
  9. cin >> t;
  10.  
  11.  
  12. for(int i = 0; i < t; i++)
  13. {
  14. int podstawa,potega,liczba = 1;
  15. cin >> podstawa >> potega;
  16. podstawa%=10;
  17. potega%=10;
  18. for(int i=0; i < potega; i++)
  19. {
  20. liczba *= podstawa;
  21. liczba %=10;
  22. }
  23.  
  24. cout << liczba << endl;
  25. }
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
Standard output is empty