返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     cin.sync_with_stdio(0);
  6.     cout.sync_with_stdio(0);
  7.     cin.tie(0);
  8.     cout.tie(0);
  9.     long long a,b,c,n=0;
  10.     cin>>a>>b>>c;
  11.     if((a!=0 && b!=0)==c){
  12.         cout<<"AND\n";
  13.         n++;
  14.     }
  15.     if((a!=0 || b!=0) ==c){
  16.         cout<<"OR\n";
  17.         n++;
  18.     }
  19.     if((a*b==0 && a+b!=0)==c){
  20.         cout<<"XOR\n";
  21.         n++;
  22.     }
  23.     if(n==0){
  24.         cout<<"IMPOSSIBLE\n";
  25.     }
  26.     return 0;
  27. }
複製代碼

TOP

返回列表