fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <math.h>
  5. #include <iomanip>
  6.  
  7. using namespace std;
  8.  
  9. long long int a, b, r; int dlugosc; int ile;
  10.  
  11. int main()
  12. {
  13. cin >> ile;
  14. for (int i=1; i<=ile; i++)
  15. {
  16. cin >> a >> b;
  17.  
  18. if ((b>4)&&(b%4!=0)) {r=b%4;}
  19. if (b%4==0) {r=4;}
  20. else r=b;
  21.  
  22. ostringstream ss;
  23. ss << setprecision (1000000000)<<pow(a,r);
  24. string str = ss.str();
  25. dlugosc=str.length();
  26.  
  27.  
  28. cout <<str.erase(0,dlugosc-1)<<endl;
  29. }
  30.  
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty