#32279: 為何它一直說我輸入題目尚未要求文字??


melodyshih0824 (超萌小辣椒)

學校 : 不指定學校
編號 : 204467
來源 : [218.166.54.147]
最後登入時間 :
2023-06-27 19:20:58
c461. apcs 邏輯運算子 (Logic Operators) -- apcs | From: [218.166.66.112] | 發表日期 : 2022-09-26 17:37

a,b,c=map(int,input().split())
flag=False
if a!=0: la=True
else:la=False
if b!=0: lb=True
else: lb=False
if c!=0: lc=True
else: lc=False
if (la and lb)==lc:
    print("AND")
    flag=True
if (la or lb)==lc:
    print("OR")
    flag=True
if (la and (not lb)) or ((not la) and lb)==lc:
    print("XOR")
    flag=True
if not flag: print("IMPOSSIBLE")
 
#32282: Re: 為何它一直說我輸入題目尚未要求文字??


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
c461. apcs 邏輯運算子 (Logic Operators) -- apcs | From: [59.115.40.119] | 發表日期 : 2022-09-26 20:09

if (la and (not lb)) or ((not la) and lb)==lc:


這一行寫錯了,所以如果輸入是"1 0 0"你會多輸出XOR

 
ZeroJudge Forum