- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int a, b, c;
- cin >> a >> b >> c;
-
- bool im = true;
- if (a != 0)
- a = 1;
- if (b != 0)
- b = 1;
- if (c != 0)
- c = 1;
- if ((a & b) == c)
- {
- cout << "AND" << endl;
- im = false;
- }
- if ((a | b) == c)
- {
- cout << "OR" << endl;
- im = false;
- }
- if ((a ^ b) == c)
- {
- cout << "XOR" << endl;
- im = false;
- }
- if (im)
- {
- cout << "IMPOSSIBLE" << endl;
- }
-
- return 0;
- system("PAUSE");
- }
複製代碼 |