fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a,b;
  8. int p;
  9. cin >> p;
  10. for(int w=1; w<=p; w++)
  11. {
  12. cin >>a >>b;
  13.  
  14. int x=a;
  15. for(int i=1;i<b;i++)
  16. {
  17. a*=x;
  18. }
  19. if(a>10)
  20. {a%=10;
  21. cout << a << endl;
  22. }
  23. else
  24. cout << " " << endl;
  25. }
  26.  
  27. return 0;
  28.  
  29. }
  30.  
  31.  
  32.  
  33.  
Success #stdin #stdout 0.01s 15240KB
stdin
Standard input is empty
stdout
9