감자튀김 공장🍟

[CodeUp]JAVA 1042~1051 본문

Algorithm/CodeUp

[CodeUp]JAVA 1042~1051

Potato potage 2021. 3. 14. 16:36
반응형

[1042]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String b[] = a.split(" ");
        int c = Integer.parseInt(b[0]);
        int d = Integer.parseInt(b[1]);
        System.out.println(c / d);
    }
}

 

 

[1043]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String b[] = a.split(" ");
        int c = Integer.parseInt(b[0]);
        int d = Integer.parseInt(b[1]);
        System.out.println(c % d);
    }
}

 

 

[1044]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long a = scanner.nextInt();
        System.out.println(a + 1);
    }
}

 

 

[1045]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String b[] = a.split(" ");
        int c = Integer.parseInt(b[0]);
        int d = Integer.parseInt(b[1]);
        float c1 = c;
        float d1 = d;

        System.out.println(c + d);
        System.out.println(c - d);
        System.out.println(c * d);
        System.out.println(c / d);
        System.out.println(c % d);
        System.out.println(String.format("%.2f", c1 / d1));
    }
}

 

 

[1046]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String b[] = a.split(" ");
        int c = Integer.parseInt(b[0]);
        int d = Integer.parseInt(b[1]);
        int e = Integer.parseInt(b[2]);

        int sum = c + d + e;
        float sum2 = sum / 3;

        System.out.println(sum);
        System.out.println(String.format("%.1f", sum2));
    }
}

 

 

[1047]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        System.out.printf("%d", a << 1);
    }
}

 

 

[1048]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.next();
        String b = scanner.next();

        int a1 = Integer.parseInt(a);
        int b1 = Integer.parseInt(b);

        System.out.printf("%d", a1 << b1);
    }
}

 

 

[1049]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if(a > b) {
            System.out.println(1);
        }
        else {
            System.out.println(0);
        }
    }
}

 

 

[1050]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if(a == b) {
            System.out.println(1);
        }
        else {
            System.out.println(0);
        }
    }
}

 

 

[1051]

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if(a <= b) {
            System.out.println(1);
        }
        else {
            System.out.println(0);
        }
    }
}
반응형

'Algorithm > CodeUp' 카테고리의 다른 글

[CodeUp]JAVA 1062~1071  (0) 2021.03.16
[Codeup]JAVA 1052~1061  (0) 2021.03.15
[CodeUp]JAVA 1032~1041  (0) 2021.03.13
[CodeUp]JAVA 1022~1031  (0) 2021.03.13
[CodeUP]JAVA 1012~1021  (0) 2021.03.12
Comments