- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,c;
- //cout<<"Please input a b and 1/0 :";
- cin>>a>>b>>c;
- bool impossible=true;
- if(a)
- a=1;
- if(b)
- b=1;
- if((a&b) == c){
- cout<<"AND"<<endl;
- impossible=false;
- }
- if((a|b) == c){
- cout<<"OR"<<endl;
- impossible=false;
- }
- if((a^b) == c){
- cout<<"XOR"<<endl;
- impossible=false;
- }
- if(impossible)
- cout<<"IMPOSSIBLE"<<endl;
- return 0;
- }
複製代碼 |