반응형
# 1093
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[24];
for (int i = 0; i < n; i++) {
int num = sc.nextInt();
arr[num - 1] += 1;
}
for (int i = 0; i < 23; i++) {
System.out.print(arr[i] + " ");
}
}
}
# 1094
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
int num = sc.nextInt();
arr[i] = num;
}
for (int i = arr.length - 1; i >= 0; i--) {
System.out.print(arr[i] + " ");
}
}
}
# 1095
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int min = 0;
for (int i = 0; i < n; i++) {
int num = sc.nextInt();
if (i == 0) {
min = num;
} else if (min > num) {
min = num;
}
}
System.out.println(min);
}
}
# 1096
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[][] arr = new int[19][19];
int N = sc.nextInt();
for (int i = 0; i < N; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
arr[x - 1][y - 1] = 1;
}
for (int i = 0; i < 19; i++) {
for (int j = 0; j < 19; j++) {
System.out.print(arr[i][j] + " ");
}
System.out.println();
}
}
}
반응형
'개인 공부 > JAVA' 카테고리의 다른 글
[Java/Spring] JAR와 WAR의 차이 (0) | 2021.07.02 |
---|---|
[JAVA] Code Up 기초 100제 (1097~ 1099) (0) | 2021.06.28 |
[JAVA] Code Up 기초 100제 (1088 ~ 1092) (0) | 2021.06.26 |
[JAVA] Code Up 기초 100제 (1083 ~ 1087) (0) | 2021.06.25 |
[JAVA] Code Up 기초 100제 (1073 ~ 1082) (0) | 2021.06.24 |