-
[Baekjoon Online Judge] 11047번: 동전 0문제 풀이/Baekjoon Online Judge 2020. 12. 25. 17:43
11047번: 동전 0
import java.io.*; public class Baekjoon11047 { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out)); String[] inputSplit = bufferedReader.readLine().split(" "); int n = Integer.parseInt(inputSplit[0]); // 동전의 종류 개수 int k = Integer.parseInt(inputSplit[1]); // 동전 가치의 합 int[] monies = new int[n]; for (int i = 0; i < monies.length; i++) { monies[i] = Integer.parseInt(bufferedReader.readLine()); } int count = 0; for (int i = n - 1; i >= 0; i--) { count += k / monies[i]; k %= monies[i]; } bufferedWriter.write(String.valueOf(count)); bufferedWriter.flush(); bufferedReader.close(); bufferedWriter.close(); } }
'문제 풀이 > Baekjoon Online Judge' 카테고리의 다른 글
[Baekjoon Online Judge] 2217번: 로프 (0) 2020.12.26 [Baekjoon Online Judge] 5585번: 거스름돈 (0) 2020.12.26 [Baekjoon Online Judge] 1931번: 회의실배정 (0) 2020.12.25 [Baekjoon Online Judge] 11399번: ATM (0) 2020.12.23 [Baekjoon Online Judge] 2839번: 설탕 배달 (0) 2020.12.23