Advertisement
hkshakib

Untitled

Jul 29th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. long long binpow(long long a, long long b,long long c)
  5. {
  6. if (b == 0)
  7. return 1;
  8. long long res = binpow(a, b / 2,1000);
  9. res=(res * res)%1000;
  10. if(b%2==1)
  11. res= (res * a)%1000;
  12. return res;
  13. }
  14. int main()
  15. {
  16. int t;
  17. cin>>t;
  18. while(t--)
  19. {
  20. long long a,b;
  21. cin>>a>>b;
  22. double x=b*(log10(a));
  23. x=x-(int)x;
  24. double ans=pow(10, x);
  25. ans=ans*100;
  26. cout<<(int)ans<<"...";
  27. printf("%03d\n", binpow(a, b, 1000));
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement