728x90

2024/03/05 7

[백준 자바] 8545번(Zadanie próbne) | 문자열 거꾸로 출력하기 (.reverse())

난이도 - 브론즈 5 문제 Napisz program, który odwraca podane słowo trzyliterowe. 입력 W pierwszym i jedynym wierszu podane jest jedno słowo trzyliterowe. 출력 Pierwszy i jedyny wiersz wyjścia powinien zawierać odwrócone słowo wejściowe. 입력받은 문자열을 거꾸로 출력하는 간단한 문제. StringBuffer와 reverse() 메서드를 사용했다. import java.io.*; public class Main8545 { public static void main(String[] args) throws Exception { BufferedRead..

백준/Java 2024.03.05

[백준 자바] 2908번(상수) | StringBuffer.reverse()

난이도 - 브론즈 2 문제 상근이의 동생 상수는 수학을 정말 못한다. 상수는 숫자를 읽는데 문제가 있다. 이렇게 수학을 못하는 상수를 위해서 상근이는 수의 크기를 비교하는 문제를 내주었다. 상근이는 세 자리 수 두 개를 칠판에 써주었다. 그 다음에 크기가 큰 수를 말해보라고 했다. 상수는 수를 다른 사람과 다르게 거꾸로 읽는다. 예를 들어, 734와 893을 칠판에 적었다면, 상수는 이 수를 437과 398로 읽는다. 따라서, 상수는 두 수중 큰 수인 437을 큰 수라고 말할 것이다. 두 수가 주어졌을 때, 상수의 대답을 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 상근이가 칠판에 적은 두 수 A와 B가 주어진다. 두 수는 같지 않은 세 자리 수이며, 0이 포함되어 있지 않다. 출력 첫째 줄에 상수의..

백준/Java 2024.03.05

[백준 자바] 2741번(N 찍기), 2742번(기찍 N)

2741번 - N 찍기 난이도 - 브론즈 5 문제 자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 100,000보다 작거나 같은 자연수 N이 주어진다. 출력 첫째 줄부터 N번째 줄 까지 차례대로 출력한다. import java.io.*; public class Main2741 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); i..

백준/Java 2024.03.05

[Java] BigInteger 클래스란? - 엄청 큰 정수 다루기

BigInteger 클래스 BigInteger 클래스는 long의 범위를 넘는 엄청 큰 정수를 다루며, java.math 패키지에 포함되어 있다. 메서드를 통해 사칙연산 등을 할 수 있으며, 사칙연산의 대상또한 BigInteger이어야 한다. StringBuffer 클래스 생성자 BigInteger(Byte[]) BigInteger의 두 개의 보수 이진 표현을 포함하는 바이트 배열을 BigInteger로 변환합니다. BigInteger(Btye[], int32, int32) BigInteger의 두 개의 보수 이진 표현을 포함하는 바이트 하위 배열을 BigInteger로 변환합니다. BigInteger(int32, Byte[]) BigInteger의 부호 크기 표현을 BigInteger로 변환합니다. B..

Java 2024.03.05

[백준 자바] 22193번(Multiply) | BigInteger 클래스 사용하기

난이도 - 브론즈 5 문제 Write a program that computes a product of two non-negative integers A and B. The integers are represented in decimal notation and have N and M digits, respectively. 입력 The first line contains the lengths N and M, separated by a space. A is given on the second and B on the third line. The numbers will not have leading zeros. 출력 Output the product of A and B without leading zeros. ..

백준/Java 2024.03.05

[백준 자바] 별 찍기 시리즈(5~7) - 2442번, 2443번, 2444번

2442번 - 별 찍기 5 난이도 - 브론즈 3 예제 출력) * *** ***** ******* ********* 코드) import java.io.*;; 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()); StringBuilder sb=new StringBuilder(); for (i..

백준/Java 2024.03.05
728x90