From b91c228fa5255d64065b0e01a84db9a653b2ed78 Mon Sep 17 00:00:00 2001 From: yongjun-0903 <472dyd@gmail.com> Date: Tue, 20 May 2025 00:24:57 +0900 Subject: [PATCH] =?UTF-8?q?kyj=20=ED=94=84=EB=A1=9C=EA=B7=B8=EB=9E=98?= =?UTF-8?q?=EB=A8=B8=EC=8A=A4=20=EB=A7=88=EB=B2=95=EC=9D=98=20=EC=97=98?= =?UTF-8?q?=EB=A6=AC=EB=B2=A0=EC=9D=B4=ED=84=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...54\353\262\240\354\235\264\355\204\260.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "\352\271\200\354\232\251\354\244\200/\353\247\210\353\262\225\354\235\230 \354\227\230\353\246\254\353\262\240\354\235\264\355\204\260.py" diff --git "a/\352\271\200\354\232\251\354\244\200/\353\247\210\353\262\225\354\235\230 \354\227\230\353\246\254\353\262\240\354\235\264\355\204\260.py" "b/\352\271\200\354\232\251\354\244\200/\353\247\210\353\262\225\354\235\230 \354\227\230\353\246\254\353\262\240\354\235\264\355\204\260.py" new file mode 100644 index 0000000..e1b0dbc --- /dev/null +++ "b/\352\271\200\354\232\251\354\244\200/\353\247\210\353\262\225\354\235\230 \354\227\230\353\246\254\353\262\240\354\235\264\355\204\260.py" @@ -0,0 +1,20 @@ +def solution(storey): + answer = 0 + while storey > 0: + digit = storey % 10 + next_digit = (storey // 10) % 10 + + if digit > 5: + answer += (10 - digit) + storey += 10 # 올림 처리 + elif digit < 5: + answer += digit + else: # digit == 5 + if next_digit >= 5: + answer += 5 + storey += 10 # 올림 + else: + answer += 5 # 그냥 내림 + storey //= 10 + + return answer