Advertisement
Egor_1425

Untitled

Jul 14th, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, count = 0, a;
  8.     cin >> n;
  9.     for (int c = 1; c <= n; c++)
  10.     {
  11.         for (int b = 1; b <= c; b++)
  12.         {
  13.             a = b ^ c;
  14.             if (a <= b and a + b > c)
  15.             {
  16.                 count++;
  17.             }
  18.         }
  19.     }
  20.  
  21.     cout << count;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement