DINGA DINGA
article thumbnail
[백준] 1157번: 단어 공부
JAVA/BOJ 2021. 7. 19. 17:23

https://www.acmicpc.net/problem/1157 1157번: 단어 공부 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next().toUpperCase();// 문자열 입력 받음 int check[] = new int[26]; for (int i = 0; i < s.length(); i++)// 문..

article thumbnail
[백준] 2675번: 문자열 반복
JAVA/BOJ 2021. 7. 19. 16:53

https://www.acmicpc.net/problem/2675 2675번: 문자열 반복 문자열 S를 입력받은 후에, 각 문자를 R번 반복해 새 문자열 P를 만든 후 출력하는 프로그램을 작성하시오. 즉, 첫 번째 문자를 R번 반복하고, 두 번째 문자를 R번 반복하는 식으로 P를 만들면 된다 www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t != 0) { int r = sc.nextInt(); String s = sc.next(); for (int..

article thumbnail
[백준] 1929번: 소수 구하기
JAVA/BOJ 2021. 7. 18. 15:34

https://www.acmicpc.net/problem/1929 1929번: 소수 구하기 첫째 줄에 자연수 M과 N이 빈 칸을 사이에 두고 주어진다. (1 ≤ M ≤ N ≤ 1,000,000) M이상 N이하의 소수가 하나 이상 있는 입력만 주어진다. www.acmicpc.net 코드 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt(); int n = scanner.nextInt(); boolean[] b = new boolean[n + 1]; b[0] = b[1] = true; f..

article thumbnail
[백준] 4153번: 직각삼각형
JAVA/BOJ 2021. 7. 18. 15:15

https://www.acmicpc.net/problem/4153 4153번: 직각삼각형 입력은 여러개의 테스트케이스로 주어지며 마지막줄에는 0 0 0이 입력된다. 각 테스트케이스는 모두 30,000보다 작은 양의 정수로 주어지며, 각 입력은 변의 길이를 의미한다. www.acmicpc.net 코드 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] n = new int[3]; while (true) { for (int i = 0; i < 3; i++) n[i] = scan..

728x90