fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int proby;
  4. long int a,b;
  5.  
  6.  
  7. long int pot(long int a,long int b)
  8. {
  9. if(b==0) return 1;
  10.  
  11. else return a*pot(a,b-1);
  12. }
  13.  
  14.  
  15. int main()
  16. {
  17. cin>>proby;
  18. while (proby--)
  19. {
  20. cin>>a>>b;
  21. cout<<pot(a,b)%10<<endl;
  22.  
  23. }
  24.  
  25.  
  26.  
  27. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty