본문 바로가기

Coding Test/백준

(78)
[백준/자바] 2480 - 주사위 세개 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 = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken()); int b = Integer.pa..
[백준/자바] 2525 - 오븐 시계 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 = new StringTokenizer(br.readLine()); int hour = Integer.parseInt(st.nextToken()); int minuit = In..
[백준/자바] 2884 - 알람 시계 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 = new StringTokenizer(br.readLine()); int hour = Integer.parseInt(st.nextToken()); int minuit = In..
[백준/자바] 11382 - 꼬마 정민 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); System.out.println(a + b + c); sc.close(); } } Scanner를 이용하니 런타임 에러가 떴다. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; publi..
[백준/자바] 11660 - 구간 합 구하기 5 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 = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int q = Integer.pa..
[백준/자바] 11659 - 구간 합 구하기 4 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int line = sc.nextInt(); int[] sumArr = new int[n + 1]; for(int i=1; i
[백준/자바] 1546 - 평균 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] scores = new int[n]; double max = 0; for(int i=0; i
[백준/자바] 11720 - 숫자의 합 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String numbers = sc.next(); int result = 0; char[] cArr = numbers.toCharArray(); for(char c : cArr) { result += c - '0'; } System.out.println(result); sc.close(); } }