fork(6) download
  1. // czy umiesz potegowac.cpp : Ten plik zawiera funkcję „main”. W nim rozpoczyna się i kończy wykonywanie programu.
  2. //
  3.  
  4. #include <iostream>
  5. #include <stdio.h>
  6. #include <string>
  7. #include <cmath>
  8. using namespace std;
  9.  
  10.  
  11. int main()
  12. {
  13. int d;
  14. scanf("%d", &d);
  15.  
  16. while (d--) {
  17. int a, b;
  18. scanf("%d%d", &a, &b);
  19.  
  20. string s = to_string(pow(a, b));
  21. int n = s.length() -8;
  22. cout << s[n] << endl;
  23. }
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 4940KB
stdin
2
2 3
3 3
stdout
8
7