전체 글

나는 실시간으로 강해지고 있는 백엔드 개발자.
· PS - CodeUp
기초 5-3 2차원 배열 ## 1096 19*19의 바둑 판이 있다 > 바둑알 몇 개 놓을건지 입력 > 차례로 그만큼 좌표(두 수) 입력 > 바둑판 빈거 0 있는거 1로 출력 import java.util.Scanner; public class CodeUp1096 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[][] map = new int[19][19]; int n = sc.nextInt(); int[][] inp = new int[n][2]; for(int i = 0;i 좌표 해당하는 행과 열 전부를 뒤집음 (0은 1로 1은 0으로) import java.util.Scanner; public cla..
· PS - CodeUp
기초 5-1 1차원 배열 ## 1093 이상한 출석 1 1~23 사이를 몇번 부를건지 입력 > 그만큼 숫자를 입력 > 각 번호가 몇 번 불렸는지 출력 import java.util.Scanner; public class CodeUp1093 { public static void main(String[] args) { int[] num = new int[23]; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] call = new int[n]; for (int i = 0; i < n; i++) { call[i] = sc.nextInt(); } sc.close(); for (int e : call) { num[e - 1]++; } for (in..
· PS - CodeUp
> 전에 C인가 Python인가 배울 때 정렬 관련해서 여러 알고리즘이 있다고 들었는데... 어떤 방법들이 있는지, 그리고 어떤 상황에서 어떤 방법이 빠른지 궁금했다. 나중에 배우게 될 지는 모르겠지만, 그냥 혼자 문제 풀면서 정리해봤다. 기초 5-4 데이터 정렬 ## 1441 버블 정렬 - 인접한 두 원소 검사, 작은 걸 앞으로. (오름차순) import java.util.Scanner; public class CodeUp1441 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[10001]; int temp; int n = sc.nextInt(); // 개수 for (int i..
· 코딩/Java
Type Bits Range of Values byte 8bits -128 ~ 127 short 16bits -32,768 ~ 32,767 int 32bits -2,147,483,648 ~ 2,147,483,647 long 64bits -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 float 32bits IEE 754-1985 기준 double 64bits char 16bits \u0000 ~ \uffff boolean 1bit true, false 흠 참고로 byte 의 8bits는 -(2^7) ~ (2^7)-1 이런 식으로 계산
· PS - CodeUp
## 1099 기초 5-3 2차원 배열 성실한 개미 - 10*10의 판이 있음. 상하좌우는 모두 벽. - 벽은 1, 길은 0, 먹이는 2. 개미가 걸어가는 길은 9로 체크. - 개미는 (2,2)에서 출발 - 무조건 오른쪽으로, 오른쪽이 벽이면 아래로, 오른쪽과 아래가 벽이거나, 먹이를 찾으면 멈춤. - 멈출 때 까지 개미가 간 길을 9로 체크된 10*10으로 다시 출력. import java.util.Scanner; public class CodeUp1099 { public static void main(String[] args) { // 10*10 입력 Scanner sc = new Scanner(System.in); byte[][] map = new byte[10][10]; for (int i = 0..
· PS - CodeUp
## 1416 기초 5-1 1차원 배열 2진수 변환 import java.util.Scanner; public class CodeUp1416 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); byte[] arr = new byte[32]; for (int i = 31; i >= 0; i--) { if (n / (int) Math.pow(2, i) == 1) { arr[i]++; n -= (int) Math.pow(2, i); } } int first = 0; for (int i = 31; i >= 0; i--) { if (arr[i] == 1) first++; if (fir..
· PS - CodeUp
다 하긴 했는데 다 올리긴 좀 그렇고... 먼가 더 깔끔하게 할 수 있을까? 싶었던 것들을 올려본다. (1172 1274 1278 1380) ## 1172 세 수 정렬하기 import java.util.Scanner; public class CodeUp1172 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); if (a < b && a < c) { System.out.print(a + " "); if (b < c) System.out.print(b + " " + c); else System.out..
승농
개발자국의 승농