fork download
  1. #include <iostream>
  2. #include <cstdint>
  3. #include <cmath>
  4.  
  5. int main(){
  6. double a = 0, b = 0, c = 0, d = 0, x = 0;
  7. double X = 0;
  8. std::uint64_t N = 10000000;
  9. std::uint64_t M = 5;
  10.  
  11. for (std::uint64_t i = 0; i < N; i++){
  12. a = std::pow(i, M);
  13. for (std::uint64_t j = i + 1; j < N; j++){
  14. b = std::pow(j, M);
  15. for (std::uint64_t k = j + 1; k < N; k++){
  16. c = std::pow(k, M);
  17. for (std::uint64_t l = k + 1; l < N; l++){
  18. d = std::pow(l, M);
  19. x = a + b + c + d;
  20. X = std::pow(x, 1 / static_cast<double>(M));
  21. if (X == std::floor(X)) std::cout << i << ' ' << j << ' ' << k << ' ' << l << ' ' << X << std::endl;
  22. }
  23. }
  24. }
  25. }
  26. }
Time limit exceeded #stdin #stdout 5s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty