fork(3) download
  1. #include <iostream>
  2. #include<math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int ile;
  9. cin>>ile;
  10. for(int i=0; i<ile; i++)
  11. {
  12. int a,b;
  13. cin>>a>>b;
  14. if(1 <= a,b <= 1000000000)
  15. {
  16. int c= a%10;
  17. int d =b%10;
  18. if(c == 0) c=10;
  19. if(d == 0) d=10;
  20. int e= pow(c,d);
  21. cout<<e%10<<endl;
  22. };
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 15232KB
stdin
7
7 1
7 2
7 3
7 4
7 5
9999 9999
stdout
7
9
3
1
7
9
9