#24632: 測試AC 送出卻NA 求大神幫忙QQ java


a0908639291@gmail.com (抽獎仔)

學校 : 臺中市私立青年高級中學
編號 : 143642
來源 : [116.89.141.186]
最後登入時間 :
2021-05-02 20:23:22
c461. apcs 邏輯運算子 (Logic Operators) -- apcs | From: [180.217.142.235] | 發表日期 : 2021-03-11 18:47

import java.util.Scanner;

public class c461 {

public static void main(String[]args) {

Scanner s=new Scanner(System.in);

String o;

long a,b,c;

while(s.hasNext()){

o=s.next();

a=s.nextLong();

b=s.nextLong();

c=s.nextLong();

System.out.println(o);

if (a == 0 && b == 0 ) {

if(c==0) {

System.out.println("AND");

System.out.println("OR");

System.out.println("XOR");

}else if(c!=0) {

System.out.println("IMPOSSIBLE");

}

}

else if (a == 0 && b != 0 || a != 0 && b == 0 ) {

if(c==0) {

System.out.println("AND");

}else if(c!=0) {

System.out.println("OR");

System.out.println("XOR");

}

}

else if (a != 0 && b != 0 ) {

if(c!=0) {

System.out.println("AND");

System.out.println("OR");

}else if(c==0) {

System.out.println("XOR");

}

}

}

}

}

 
ZeroJudge Forum