✍쪠와 함께 하루에 30분 이상 시작✨
10818
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] array = new int[N];
for(int i = 0; i<N; i++) {
array[i] = sc.nextInt();
}
sc.close();
Arrays.sort(array);
System.out.println(array[0] +" " + array[N - 1]);
}
}
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N;
N = sc.nextInt();
int[] array = new int[N];
int max = -1000000;
int min = 100000;
for(int i=0; i<array.length; i++) {
array[i] = sc.nextInt();
if(array[i] > max) {
max = array[i];
}
if(array[i] < min) {
min = array[i];
}
}
System.out.println(min + " " + max);
}
}
2562
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] array = new int[9];
int max = 0;
int index = 0;
for(int i = 0; i<array.length; i++) {
array[i] = sc.nextInt();
if(array[i]> max) {
max = array[i];
index = i + 1;
}
}
System.out.println(max);
System.out.println(index);
}
}
2577
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int A = sc.nextInt();
int B = sc.nextInt();
int C = sc.nextInt();
sc.close();
int mul = A*B*C;
int[]arr = new int[10];
while(mul>0) {
arr[mul%10]++;
mul /= 10;
}
for(int i = 0; i< arr.length; i++) {
System.out.println(arr[i]);
}
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int value = (in.nextInt() * in.nextInt() * in.nextInt());
String str = Integer.toString(value);
in.close();
for (int i = 0; i < 10; i++) {
int count = 0;
for (int j = 0; j < str.length(); j++) {
if ((str.charAt(j) - '0') == i) {
count++;
}
}
System.out.println(count);
}
}
}
3052
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] array = new int[10];
boolean[] arr = new boolean[42];
int A = 0;
for(int i= 0; i<array.length; i++) {
array[i] = sc.nextInt();
arr[array[i] % 42] = true;
}
int count = 0;
for(boolean value : arr) {
if(value) {
count++;
}
}
System.out.println(count);
}
}