fork download
  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::endl;
  5.  
  6. bool fermat ()
  7. {
  8. const long long MAX = 1'000'000;
  9. long long a=1, b=1, c=1;
  10.  
  11. for (;;) {
  12. if (a*a*a == b*b*b+c*c*c)
  13. return true;
  14.  
  15. a++;
  16. if (a>MAX) {
  17. a=1;
  18. b++;
  19. }
  20.  
  21. if (b>MAX) {
  22. b=1;
  23. c++;
  24. }
  25.  
  26. if (c>MAX) {
  27. c=1;
  28. }
  29. }
  30.  
  31. return false;
  32. }
  33.  
  34. int main() {
  35. if (fermat()) {
  36. cout << "Fermat's Last Theorem has been disproved.\n";
  37. } else {
  38. cout << "Fermat's Last Theorem has not been disproved.\n";
  39. }
  40. }
Success #stdin #stdout 0.01s 5512KB
stdin
Standard input is empty
stdout
Fermat's Last Theorem has been disproved.