fork(1) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. unsigned int potega(int x, int y)
  6. {
  7. if (y == 0) return 1;
  8. else return x* potega(x, y - 1);
  9. }
  10.  
  11. int main()
  12. {
  13. int ile;
  14. cin >> ile;
  15. for (int i = 0; i < ile; i++)
  16. {
  17. unsigned int x, y;
  18. cin >> x >> y;
  19. cout << potega(x, y)%10 << endl;
  20. }
  21.  
  22. return 0;
  23. }
  24.  
  25.  
Success #stdin #stdout 0.01s 5532KB
stdin
2
2 3
3 3
stdout
8
7