fork(2) download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5. int ile, a, b;
  6.  
  7. void ile_razy (int ile){
  8. for (int i=0; i<ile; i++)
  9. {
  10. cin>>a>>b;
  11. cout<<(int)pow(a,b)%10<<endl;
  12. }
  13. }
  14. int main() {
  15. cin>>ile;
  16. ile_razy(ile);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 4536KB
stdin
5
1 7
3 4
3 3
4 7
9 8
stdout
1
1
7
4
1