返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     cin.tie(0);
  6.     cin.sync_with_stdio(0);
  7.     int a,b,c,x=0,s=0;
  8.     cin>>a>>b>>c;
  9.     if(c){

  10.         if(a&&b){
  11.             cout<<"AND"<<endl;
  12.             s++;
  13.         }
  14.         if(a||b){
  15.             cout<<"OR"<<endl;
  16.             s++;
  17.         }
  18.         if(!(a==b)){
  19.             cout<<"XOR"<<endl;
  20.             s++;
  21.         }
  22.         if(s){

  23.         }else{
  24.             cout<<"IMPOSSIBLE";
  25.         }
  26.     }else{

  27.         if(!(a&&b)){
  28.             cout<<"AND"<<endl;
  29.             x++;
  30.         }
  31.         if(!(a||b)){
  32.             cout<<"OR"<<endl;
  33.             x++;
  34.         }
  35.         if(a==b){
  36.             cout<<"XOR"<<endl;
  37.             x++;
  38.         }else if(a!=0&&b!=0){
  39.             cout<<"XOR"<<endl;
  40.             x++;
  41.         }
  42.         if(x){

  43.         }else{
  44.             cout<<"IMPOSSIBLE";
  45.         }
  46.     }
  47.     return 0;
  48. }
複製代碼

TOP

返回列表