감자튀김 공장🍟

[CodeUp]JAVA 1082~1091 본문

Algorithm/CodeUp

[CodeUp]JAVA 1082~1091

Potato potage 2021. 3. 18. 14:00
반응형

[1082]

import java.util.Scanner;

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

        String a = scanner.next();
        int n = Integer.parseInt(a, 16);

        for(int i = 0; i < 16; i++) {
            System.out.printf("%X * %x = %X\n", n, i, n*i);
        }
    }
}

 

[1083]

import java.util.Scanner;

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

        int a = scanner.nextInt();

        if(a > 0 && a < 10) {
            for(int i = 1; i <= a; i++) {
                if(i % 3 == 0) {
                    System.out.print("X ");
                }
                else
                    System.out.print(i + " ");
            }
        }
    }
}

 

 

[1084]

import java.util.Scanner;

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

        int r = scanner.nextInt();
        int g = scanner.nextInt();
        int b = scanner.nextInt();
        int result = 0;

        for(int i = 0; i < r; i++) {
            for(int j = 0; j < g; j++) {
                for(int k = 0; k < b; k++){
                    System.out.printf("%d %d %d\n", i, j, k);
                    result++;
                }
            }
        }
        System.out.println(result);

    }
}

 

 

[1085]

import java.util.Scanner;

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

        int h = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int s = scanner.nextInt();
        int result = 0;

        if(h > 0 && h <= 48000 &&
            b > 0 && b <= 32 && b % 8 == 0 &&
            c > 0 && c <= 5 &&
            s > 0 && s <= 4000) {
            result = h * b * c * s;
        }
        // Math.pow(2, 10) -> 2의 10승
        // x = h*b*c*s / 8
        // y = x / 1024 byte = KB
        // res = y / 1024 byte = MB
        double res = ((result / 8) / Math.pow(2, 10)) / Math.pow(2, 10);
        System.out.format("%.1f MB", res);
    }
}

 

 

[1086]

import java.util.Scanner;

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

        int w = scanner.nextInt();
        int h = scanner.nextInt();
        int b = scanner.nextInt();
        int result = 0;

        if(w > 0 && w <= 1024 &&
            h > 0 && h <= 1024 &&
            b > 0 && b <= 40 && b % 4 == 0) {
            result = (w * h * b) / 8;
        }
        double res = (result / Math.pow(2, 10) / Math.pow(2, 10));
        System.out.format("%.2f MB", res);
    }
}

 

 

[1087]

import java.util.Scanner;

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

        int a = scanner.nextInt();
        int result = 0;

        for(int i = 0; ; i++) {
            result += i;
            if(result >= a) {
                break;
            }
        }
        System.out.println(result);

    }
}

 

 

[1088]

import java.util.Scanner;

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

        int a = scanner.nextInt();
        int result = 0;

        for(int i = 0; i <= a; i++) {
            if(i % 3 == 0) {
                continue; // 아래 코드 건너뛰고 i++
            }
            System.out.print(i + " ");
        }

    }
}

 

 

[1089]

import java.util.Scanner;

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

        int a = scanner.nextInt();
        int d = scanner.nextInt();
        int n = scanner.nextInt();

        if(a >= 0 && a <= 100 &&
                d >= 0 && d <= 100 &&
                n >= 0 && n <= 100) {
            for(int i = a; i < n; i++) {
                a += d;
            }
        }
        System.out.println(a);
    }
}

 

 

[1090]

import java.util.Scanner;

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

        int a = scanner.nextInt();
        int r = scanner.nextInt();
        int n = scanner.nextInt();

        if(a >= 0 && a <= 10 &&
                r >= 0 && r <= 10 &&
                n >= 0 && n <= 10) {
            for(int i = 1; i < n; i++) {
               a *= r;
            }
        }
        System.out.println(a);
    }
}

 

 

[1091]

import java.util.Scanner;

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

        int a = scanner.nextInt();
        int m = scanner.nextInt();
        int d = scanner.nextInt();
        int n = scanner.nextInt();

        if(a >= -50 && a <= 50 &&
                m >= -50 && m <= 50 &&
                d >= -50 && d <= 50 &&
                n >= 0 && n <= 10) {
            for(int i = a; i < n; i++) {
               a = (a * m) + d;
            }
        }
        System.out.println(a);
    }
}
반응형

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

[CodeUp]JAVA 1092~1099  (0) 2021.03.19
[CodeUp]JAVA 1072~1081  (0) 2021.03.17
[CodeUp]JAVA 1062~1071  (0) 2021.03.16
[Codeup]JAVA 1052~1061  (0) 2021.03.15
[CodeUp]JAVA 1042~1051  (0) 2021.03.14
Comments