백준 2231 자바1 백준 2231번 분해합 분해합은 어떤 자연수 N이 주어졌을 때, 생성자 숫자를 구하는 문제다. 반대로 분해합은 어떤 자연수 N과 N을 이루는 각 자리수의 합을 의미한다. 예를 들어 N = 245 라면 분해합은 245 + (2 + 4 + 5) = 256 이다. 이 문제는 숫자를 증가시키며 분해합을 계산하고, 그 계산값이 N과 일치하는 숫자를 출력해 풀이하였다. import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = in.nextInt(); int ans = func(N); System.out.println(.. 2023. 3. 13. 이전 1 다음