Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 리덕스장바구니
- Redux
- memory
- 기초100제
- 알고리즘
- Spring
- OS
- C++
- 정렬
- js to ts
- 백준
- 프로그래머스
- 분할메모리할당
- 스프링
- 공부
- 일상
- CPU 스케줄링
- web
- 타입스크립트
- Operating System
- react-redux
- 토이프로젝트
- 협업
- error
- react
- 코드업
- 자료구조
- Java
- 파이썬
- codeup
Archives
- Today
- Total
감자튀김 공장🍟
[CodeUp]JAVA 1092~1099 본문
반응형
[1092]
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();
int c = scanner.nextInt();
int day = 1;
while(day % a != 0 || day % b != 0 || day % c != 0) {
day++;
// while문 조건의 역을 생각해보자
}
System.out.print(day);
}
}
[1093]
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a[] = new int[24];
for(int i = 0; i < a.length; i++) {
a[i] = 0;
}
int b = scanner.nextInt();
for(int i = 1; i <= b; i++) {
int c = scanner.nextInt();
a[c] += 1;
}
for(int i = 0 ; i < a.length; i++) {
System.out.print(a[i] + " ");
}
}
}
[1094]
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[] = new int[a];
for(int i = 0; i < b.length; i++) {
b[i] = scanner.nextInt();
}
for(int i = b.length -1 ; i >= 0; i--) {
System.out.print(b[i] + " ");
}
}
}
[1095]
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[] = new int[a];
int min = 24;
for(int i = 0; i < a; i++) {
b[i] = scanner.nextInt();
if(min > b[i])
min = b[i];
}
System.out.print(min);
}
}
[1096]
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a[][] = new int[20][20];
int n = scanner.nextInt();
for(int i = 0; i < n; i++) {
int x = scanner.nextInt();
int y = scanner.nextInt();
a[x-1][y-1] = 1;
}
for(int i = 0; i < a.length-1; i++) {
for(int j = 0; j < a.length-1; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
}
[1097]
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a[][] = new int[19][19];
for(int i = 0; i < a.length; i++) {
for(int j = 0; j < a.length; j++) {
a[i][j] = scanner.nextInt();
}
}
int n = scanner.nextInt();
for(int i = 0; i < n; i++) {
int x = scanner.nextInt()-1;
int y = scanner.nextInt()-1;
for(int j = 0; j < a.length; j++) {
if(a[x][j] == 0)
a[x][j] = 1;
else
a[x][j] = 0;
}
for(int k = 0; k < a.length; k++) {
if(a[k][y] == 0)
a[k][y] = 1;
else
a[k][y] = 0;
}
}
for(int i = 0; i < a.length; i++){
for(int j = 0; j < a.length; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
}
[1098]
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 n = scanner.nextInt();
int a[][] = new int[h+1][w+1];
for(int i = 0; i < n; i++) {
int l = scanner.nextInt();
int d = scanner.nextInt();
int x = scanner.nextInt();
int y = scanner.nextInt();
if(d == 0) {
for(int j = 0; j < l; j++) {
a[x][y+j] = 1;
}
}
else if(d == 1) {
for(int j = 0; j < l; j++) {
a[x+j][y] = 1;
}
}
}
for(int i = 0; i < a.length; i++) {
for(int j = 0; j < a.length; j++) {
System.out.print(a[i][j]+ " ");
}
System.out.println();
}
}
}
[1099]
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int m[][] = new int[10][10];
for(int i = 0; i < m.length; i++) {
for(int j = 0; j < m.length; j++) {
m[i][j] = scanner.nextInt();
}
}
int flag = 1;
int end = 0;
for (int i = 1; i < m.length; i++) {
if (end != 1) {
for (int j = flag; j < m.length; j++) {
if (m[i][j] == 0) {
m[i][j] = 9;
} else if (m[i][j] == 2) {
m[i][j] = 9;
end = 1;
break;
} else {
flag = j - 1;
break;
}
}
} else {
break;
}
}
for (int i = 0; i < m.length; i++) {
for (int j = 0; j < m.length; j++) {
System.out.print(m[i][j] + " ");
}
System.out.println();
}
}
}
반응형
'Algorithm > CodeUp' 카테고리의 다른 글
[CodeUp]JAVA 1082~1091 (0) | 2021.03.18 |
---|---|
[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