fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--)
  9. {
  10. int a,b,u;
  11. unsigned long long res,final;
  12. cin>>a>>b;
  13. int temp=a;
  14. u=temp%10;
  15. res=(double)pow(u,b);
  16. final=fmod(res,10);
  17. cout<<final<<"\n";
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 3300KB
stdin
5
2 99
2 100
2 101
2 102
2 103
stdout
0
0
0
0
0