import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str = br.readLine().split(" "); int A = Integer.parseInt(str[0]); int B = Integer.parseInt(str[1]); if(A > B){ System.out.println(">"); } else..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int arr[] = new int[9]; int max = arr[0]; // 최댓값을 담기 int index = 0; // 최댓값의 위치 담기 for (int i = 0; i < arr.length; i++) { arr[i] = Integer.parseInt(br.re..
import java.util.Scanner; public class BJ1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] array = new int[n]; int num = 0; for(int i = 0; i < n; i++) { array[i] = sc.nextInt(); } int v= sc.nextInt(); for(int i = 0; i < array.length; i++) { if (v == array[i]){ num++; } } System.out.println(num); } } 입력 받을 땐 BufferedReader를 사용해야 하는데 익숙하지..
2023-04-05 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class array1 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int A = Integer.parseInt(br.readLine()); //int 입력 받음 int B = Integer.parseInt(br.readLine()); int C = Integer.parseInt(br.readLine()); int..
23. 02. 09 1. 문자열을 순서대로 배열하기. 단, 문자와 문자 사이에 띄어쓰기가 들어가야하며 마지막 문자 뒤에는 띄어쓰기가 없어야 함. 풀이 1 public class Ex { public static void main(String[] args) { System.out.println(smash("먼데", "a", "b", "c", "d")); } public static String smash(String... words) { String smash = new String(); for (int i = 0; i < words.length; i++){ smash += words[i]; if (i != words.length - 1){ smash += " "; } } return smash; } } ..
정수형 실수형 문자형 논리형 1바이트 byte boolean 2바이트 short char 4바이트 int float 8바이트 long double 1. 정수형: 숫자를 담는 자료형 값의 범위 사용 byte -2^7 ~ 2^7-1 1byte 단위의 동영상, 실행 파일의 자료 처리 시 short -2^15 ~ 2^15-1 2bytes단위의 자료형 c, c++언어와 호환 시 int -2^31 ~ 2^31-1 4bytes 단위의 자료형 자바에서 사용하는 정수형의 기본형 long -2^63 ~ 2^63-1 8bytes 단위의 자료형 항상 숫자 뒤에 알파벳 L/l을 입력해 long형임을 표시 int num = 5; long count = 14L; 2. 실수형: 값의 범위 사용 float 소수점 아래 9번째 자리에서..