#27409: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
c461. apcs 邏輯運算子 (Logic Operators) -- apcs | From: [219.84.243.106] | 發表日期 : 2021-10-02 14:01

int main(){
int a, b, c;
while (cin >> a >> b >> c){
if (a!=0) a=1;
if (b!=0) b=1;
bool found=false;
if ((a&b)==c){
found=true;
cout <<"AND\n";
}
if ((a|b)==c){
found=true;
cout <<"OR\n";
}
if ((a^b)==c){
found=true;
cout <<"XOR\n";
}
if (!found)
cout <<"IMPOSSIBLE\n";
}
return 0;
}
 
測試執行不讓過,直接送出就好
 
 
ZeroJudge Forum