說明:邏輯運算子的使用。
Java 版
import java.util.Scanner;
public class D063 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int a = Integer.parseInt(in.nextLine());
System.out.println(a ^ 1);
}
}
}
Python 版 (2022.07)a = int(input())
print(a ^ 1)
沒有留言:
張貼留言