fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(void) {
  4. int T;
  5. scanf("%d",&T);
  6. while(T-->0)
  7. {
  8. long long a,b;
  9. scanf("%lld%lld",&a,&b);
  10. printf("%lld\n",(long long)pow(a%10,b%4)%10);
  11. }
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 2012KB
stdin
2
3 10
6 2
stdout
9
36