From b47feeea02f895c9863c83166a769559759fa0e9 Mon Sep 17 00:00:00 2001 From: Park Sang Woo <128164231+pswoo0323@users.noreply.github.com> Date: Fri, 10 Nov 2023 22:09:54 +0900 Subject: [PATCH] =?UTF-8?q?[04=EC=A3=BC=EC=B0=A8=20=EB=B0=95=EC=83=81?= =?UTF-8?q?=EC=9A=B0]=20=EA=B1=B0=EC=8A=A4=EB=A6=84=EB=8F=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BOJ5585" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "04\354\243\274\354\260\250/\353\260\225\354\203\201\354\232\260/BOJ5585" diff --git "a/04\354\243\274\354\260\250/\353\260\225\354\203\201\354\232\260/BOJ5585" "b/04\354\243\274\354\260\250/\353\260\225\354\203\201\354\232\260/BOJ5585" new file mode 100644 index 0000000..7221d1c --- /dev/null +++ "b/04\354\243\274\354\260\250/\353\260\225\354\203\201\354\232\260/BOJ5585" @@ -0,0 +1,28 @@ +package BAEKJOON; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class BOJ_5585 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int N = Integer.parseInt(br.readLine()); + int paymoney = 1000 - N ; + int[] arr ={500, 100, 50, 10, 5, 1}; + int i = 0; + int change = 0; + while (paymoney != 0){ + if (paymoney / arr[i] > 0 ){ + change = change + paymoney / arr[i]; //1 , 2 + paymoney = paymoney % arr[i]; //120 , 20 + + } + else { + i++; + } + } + System.out.println(change); + } +}