#43107: 救命啊 這為什麼90%阿


kenzlutkup@gmail.com (KenzluChan-TKUP)

學校 : 國立竹北高級中學
編號 : 241298
來源 : [220.129.155.165]
最後登入時間 :
2025-10-01 20:01:30

#include <bits/stdc++.h>
using namespace std;

int main() {
    int a,b,c,ip=1;
    cin>>a>>b>>c;
    if((a && b)==c){
        cout<<"AND"<<endl;
        ip=0;
    }
    if((a || b)==c){
        cout<<"OR"<<endl;
        ip=0;
    }
    if((a ^ b)==c){
        cout<<"XOR"<<endl;
        ip=0;
    }
    if(ip){
        cout<<"IMPOSSIBLE";
    }
    return 0;
}

#43108: Re: 救命啊 這為什麼90%阿


leeguanhan0909@gmail.com (李冠翰)

學校 : 高雄市苓雅區復華高級中學國中部
編號 : 276558
來源 : [36.238.189.188]
最後登入時間 :
2025-06-11 22:19:49

#include
using namespace std;

int main() {
    int a,b,c,ip=1;
    cin>>a>>b>>c;
    if((a && b)==c){
        cout<<"AND"<        ip=0;
    }
    if((a || b)==c){
        cout<<"OR"<        ip=0;
    }
    if((a ^ b)==c){
        cout<<"XOR"<        ip=0;
    }
    if(ip){
        cout<<"IMPOSSIBLE";
    }
    return 0;
}

試試看如果a或b>1,將a或b設為1