본문 바로가기

전체 글

(261)
[백준] 2562 : 최댓값 JAVA 풀이 import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int idx = 0, max = -999; for(int i=0;i
[백준] 10818 : 최소, 최대 JAVA 풀이 배열을 사용한 코드 import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int min, max, idx=0; StringTokenizer st = new StringTokenizer(br.r..
[백준] 1110 : 더하기 사이클 JAVA 풀이 import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int num = Integer.parseInt(br.readLine()); int cnt_cycle = 0, cpy = num; while(true){ num = ((num%10)*10)+(((num/10)+(num%10))%10); cnt_cycle++; if(cpy=..
[백준] 10951 : A + B - 4 JAVA 풀이 import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); // Scanner.hasNextInt()는 입력된 값이 정수가 아니면 false를 반환함 // 더 이상 정수가 입력되지 않으면 입력을 종료하기 위해서 사용했음 while(in.hasNextInt()){ // 두 정수를 입력받아 변수에 저장하고 출력 후 줄바꿈 int A = in.nextInt(); int B = in.nextInt(); System.out.println(A+B); } // 스캐너 닫음 in.close(); } } 사실!! Scanner보다 더 빠르게 입력받는 방법이 있음 ..
[백준] 10952 : A + B - 5 JAVA 풀이 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; StringBuilder sb = new StringBuilder(); int A, B; while(true){ st = new StringTokenizer(br.readLine..
[백준] 10871 : X보다 작은 수 JAVA 풀이 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStre..
[백준] 2439 : 별 찍기 - 2 JAVA 풀이 제일 처음 짠 코드 import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); for(int i=1;i
[백준] 2438 : 별 찍기 - 1 JAVA 풀이 import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); for(int i=1;i