---
# System prepended metadata

title: '題解 zerojudge c461: apcs 邏輯運算子'
tags: [APCS, c++]

---

###### tags: `APCS` `c++`
# 題解 zerojudge c461: apcs 邏輯運算子
```cpp=
#include<iostream> 
using namespace std;
int main(){
	int a,b,c;
	bool match=false;
	cin>>a>>b>>c;
	
	if(a!=0)	a=1;
	if(b!=0)	b=1;
	
	if((a&&b)==c){
		cout<<"AND\n";match=true;
	}
	if((a||b)==c){
		cout<<"OR\n";match=true;
	}	
	if((a^b)==c){
		cout<<"XOR\n";match=true;
	}
	if(!match)	cout<<"IMPOSSIBLE";
}

```