n=int(input)
nnn=1000-n
count=0
while nnn>0:
nnn=nnn%500
count+=nnn//500
nnn%=100
count+=nnn//100
nnn=nnn%50
count+=nnn//50
nnn%=10
count+=nnn//10
nnn=nnn%5
count+=nnn//5
nnn%=1
count+=nnn//1
if nnn==0:
break
I wonder why the while door doesn't work here
I know the answer is that using the for statement is better
I wonder why the door doesn't work
N = int(input())
rest = 1000 - N
moneys = [500, 100, 50, 10, 5, 1]
result = 0
for money in moneys:
if rest == 0:
break
result += rest // money
rest %= money
print(result)
n=int(input)
--> n=int(input())
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
607 Uncaught (inpromise) Error on Electron: An object could not be cloned
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
577 PHP ssh2_scp_send fails to send files as intended
599 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.