Advertisement
Solingen

z8.1.cpp

Dec 22nd, 2024
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int limit = 100;
  7.     int count = 0;
  8.  
  9.     for (int a = 1; a <= limit; a++)
  10.     {
  11.         for (int b = a; b <= limit; b++)
  12.         {
  13.             // b>=a, чтобы не дублировать тройку (a,b,c) и (b,a,c)
  14.             for (int c = b; c <= limit; c++)
  15.             {
  16.                 if (a*a + b*b == c*c)
  17.                 {
  18.                     count++;
  19.                     cout << count << ") (" << a << ", "
  20.                          << b << ", " << c << ")\n";
  21.                 }
  22.             }
  23.         }
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement