Advertisement
FaresX

Untitled

Jan 8th, 2017
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. int main()
  5. {
  6.     int a, b, c;
  7.     std::cin >> a >> b >> c;
  8.     const unsigned int numberOfValues = 3;
  9.     const unsigned int rows = 1 << numberOfValues;
  10.     const unsigned int cols = numberOfValues;
  11.     bool sumUp = false;
  12.     int tripleCombs[rows][cols] = {1, 1, 1,
  13.                                    1, -1, 1,
  14.                                    1, 1, -1,
  15.                                    1, -1, -1,
  16.                                    -1, 1, 1,
  17.                                    -1, -1, 1,
  18.                                    -1, 1, -1,
  19.                                    -1, -1, -1};
  20.  
  21.  
  22.     for (unsigned int i = 0; i < rows; i++)
  23.         for (unsigned int j = 0; j < cols; j++)
  24.             if (a * tripleCombs[i][j] + b * tripleCombs[i][j + 1] + c * tripleCombs[i][j + 2] == 13)
  25.                 sumUp = true;
  26.  
  27.  
  28.     std::cout << ((sumUp) ? "Yes" : "No") << std::endl;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement