CodeUp/Java

[CodeUp] 1059-1062 (Java)

chaereemee 2022. 11. 1. 23:23

# 1059 : 비트 단위로 NOT 하여 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        System.out.println(~num);
        sc.close();
    }
}

 

# 1060 : 비트 단위로 AND 하여 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println(num1&num2);
        sc.close();
    }
}

 

# 1061 : 비트 단위로 OR 하여 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println(num1|num2);
        sc.close();
    }
}

 

# 1062 : 비트 단위로 XOR 하여 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num1 = sc.nextInt();
        int num2 = sc.nextInt();
        System.out.println(num1^num2);
        sc.close();
    }
}

 

https://codeup.kr/index.php

 

CodeUp

☆ 파이썬 다운로드 : 파이썬3 ☆ 무료 C언어 IDE : Code::blocks       DEV C++ ☆ 추천 온라인 IDE : C   C++11   Python3   Java ☆ 채점 가능 언어 : C, C++, JAVA, Python 3.5 ★ C++로 제출시 void main()을 사용하면

codeup.kr