본문 바로가기

분류 전체보기69

[백준 11654번 - java] 아스키 코드 내 답안 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s = scan.next(); char c = s.charAt(0); int num = (int)c; System.out.println(num); } } 2021. 11. 12.
[백준 4344번 - java] 평균은 넘겠지 https://www.acmicpc.net/problem/4344 내 답안 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int C = s.nextInt(); for (int i=0; i 2021. 11. 12.
[백준 1546번 - java] 평균 https://www.acmicpc.net/problem/1546 내 답안 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); float[] score = new float[N]; float max = -1; for (int i=0; i max) max = score[i]; } float total = 0; for (int i=0; i 2021. 11. 12.
[백준 3052번 - java] 나머지 https://www.acmicpc.net/problem/3052 내 답안 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); boolean[] check = new boolean[42]; int cnt = 0; for (int i=0; i 2021. 11. 12.
git 수정내역 반영 업로드 보호되어 있는 글 입니다. 2021. 11. 9.
[백준 2577번 - java] 숫자의 개수 https://www.acmicpc.net/problem/2577 내 답안 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int A = s.nextInt(); int B = s.nextInt(); int C = s.nextInt(); int N = A * B * C; int[] cnt = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int idx; while((float)N/10 >= 0.1) { idx = N%10; cnt[idx]++; N/=10; } for (int i=0.. 2021. 11. 8.
[백준 2562번 - java] 최댓값 https://www.acmicpc.net/problem/2562 내 답안 - 1 (배열 사용) import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int[] arr = new int[9]; int max = 0; int maxIdx = 0; for (int i=0; i 2021. 11. 8.
[백준 10818번 - java] 최소, 최대 https://www.acmicpc.net/problem/10818 내 답안 - 1 (Scanner + 배열 사용) import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException{ int max = -1000001; int min = 1000001; Scanner s = new Scanner(System.in); int N = s.nextInt(); int[] arr = new int[N]; for (int i=0; i arr[i]) min = arr[i]; if (max < arr[i]) max = arr[i]; } System.o.. 2021. 11. 8.
[백준 1110번 - java] 더하기 사이클 https://www.acmicpc.net/problem/1110 내 답안 import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); int first = s.nextInt(); int N = first; int cnt = 0; while(true) { N = (10 * (N%10)) + ((N/10) + (N%10))%10; cnt++; if (first == N) break; } System.out.println(cnt); } } 2021. 11. 4.