BOJ
-
boj)2523PS/boj 2020. 8. 29. 18:06
import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int N = Integer.parseInt(br.readLine()); int line = (2*N)-1; for (int i = 1; i 감소 bw.append('*'); } } bw.newLine(); } br.close(); bw.flush(); bw.close..
-
boj)1110PS/boj 2020. 8. 29. 16:02
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)); int n = Integer.parseInt(br.readLine()); getSum(n, n, 1); } static void getSum(int num, int n, int ans) { int num1, num2, sum, result; if (num < 10) { ..
-
EOF (End of File)Algorithm 2020. 8. 29. 14:58
EOF ? - 데이터가 더 이상 존재하지 않을 때 우리는 EOF (End of Fil) 즉, 파일의 끝이라고 한다. 입력의 종료가 정해져 있지 않은 문제 ex) boj 10951 (A+B-4) https://www.acmicpc.net/problem/10951 1. 입력의 종료는 더 이상 읽을 수 있는 데이터 (EOF) 가 없을 때 종료한다. - Scanner에서 처리하는 방법 - BufferedReader에서 처리하는 방법 Scanner in=new Scanner(System.in); while(in.hasNextInt()){ int a=in.nextInt(); int b=in.nextInt(); System.out.println(a+b); } (1)Scanner BufferedReader br = n..
-
boj)10989PS/boj 2020. 8. 28. 18:11
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int N = Integer.parseInt(br.readLine());..
-
boj)1431PS/boj 2020. 8. 28. 17:34
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); ArrayList list = new ArrayList(); for (int i = 0; i < N; i++) { list.add(br.readLine()); } // 정렬 Collections.sort(list, n..
-
boj)1181PS/boj 2020. 8. 28. 16:38
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); HashSet set = new HashSet(); for (int i = 0; i < N; i++) { set.add(br.readLine()); } ArrayList list = new ArrayList(set);..
-
boj)5585PS/boj 2020. 8. 24. 23:24
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { static int T, money, count; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); T = Integer.parseInt(br.readLine()); money = 1000 - T; count += money / 500; count += money % 500 /100; count += money % 500 % 100 / 50; count += money %..
-
boj)10162PS/boj 2020. 8. 24. 22:55
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { static int A, B, C; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); if (T%10 > 0) { System.out.println(-1); } else { A = T/300; T -= A * 300; B = T/60; T -= B * 60; C = T/10; System.out.pr..