Problem:


Problem A: Summer of KMC

Description

KMCはコミックマーケットと呼ばれる同人即売会で毎年CDを販売している。
コミックマーケットでCDを売ることになったFであったが、Fの人気により、KMCの売り場には人が殺到し、お釣りの計算が追いつかない状態となった。そこでFは金額を入力すると即座にお釣りを出力するプログラムを書くことにした。

KMCが釣り銭として用意しているのは、100円玉と500円玉と1000円札のみである。これらの硬貨・札は無限にあるものと考えて良い。お釣りは、硬貨・札の個数が最小になるように選ぶ。また、KMCが販売するCDの値段は100の倍数であり、購入者が支払う金額も100の倍数である。

Input

入力は複数のテストケースから成る。

各テストケースは2つの正整数A, Bから成る。AはCDの値段であり、Bは購入者が支払った金額である。A, Bは100の倍数であり、100000000を超えない。また、A ≦ B である。

入力は0 0で終わる。

Output

各テストケースに対して、お釣りとして差し出すべき 100円玉、500円玉、1000円札の個数・枚数を一行でこの順番に出力する。各数字の間にはスペースを1つ入れる。

Sample Input

500 1000
100 10000
400 700
600 5000
10000 10000
0 0

Output for Sample Input

0 1 0
4 1 9
3 0 0
4 0 4
0 0 0



Sample input:
500 1000
100 10000
400 700
600 5000
10000 10000
0 0


Sample output:
0 1 0
4 1 9
3 0 0
4 0 4
0 0 0

Submission status: Wrong Answer

Solution code:
A,B = input().split()
A = int(A)
B = int(B)
oturi = B - A
B1 = 0
C5 = 0
C1 = 0
if oturi/1000 >= 1:
    B1+= int(oturi/1000)
    oturi = oturi-(B1*1000)
if oturi % 500 == 0:
    oturi = int(oturi)
while oturi >= 500:
    oturi-=500
    C5+=1
while oturi != 0:
    oturi-=100
    C1+=1
print(C1,C5,B1)

Submission status: Wrong Answer

Solution code:

Submission status: Wrong Answer

Solution code:
A,B = input().split()
A = int(A)
B = int(B)
oturi = B - A
B1 = 0
C5 = 0
C1 = 0
if oturi/1000 >= 1:
    B1+= int(oturi/1000)
    oturi = oturi-(B1*1000)
if oturi % 500 == 0:
    oturi = int(oturi)

while oturi >= 500:
    oturi-=500
    C5+=1
while oturi > 0:
    oturi-=100
    C1+=1
print(C1,C5,B1)

Submission status: Accepted

Solution code:
while True:
  a, b = map(int, input().split())
  if a == 0 and b == 0:break
  w = b - a
  x = w // 1000
  w %= 1000
  y = w // 500
  w %= 500
  z = w // 100
  print(z, y, x)

Submission status: Accepted

Solution code:
while True:
    s,p = list(map(int,input().split()))
    if s+p == 0:
        break
    sa = p-s
    a100 = 0
    a500 = 0
    a1000 = 0
    if sa != 0:
        a1000 = sa/1000
        sa = sa%1000
        a500 = sa/500
        sa = sa%500
        a100 = sa/100
    print(int(a100),int(a500),int(a1000))

Submission status: Accepted

Solution code:
while 1:
    a, b = map(int, raw_input().split())
    if not b:
        break
    s = b-a
    s /= 100
    c10 = s/10
    s -= c10*10
    c5 = s/5
    s -= c5*5
    print s, c5, c10

Submission status: Accepted

Solution code:
def calculate1():
    change = B - A
    if change % 1000 == 0:
        one_thousand_count = change / 1000
        print_result(one_thousand_count)
    else:
        one_thousand_count = change / 1000
        remainder = change - one_thousand_count * 1000
        calculate2(remainder, one_thousand_count)
        
def calculate2(remainder, one_thousand_count):
    if remainder % 500 == 0:
        five_hundred_count = remainder / 500
        print_result(one_thousand_count, five_hundred_count)
    else:
        five_hundred_count = remainder / 500
        remainder = remainder - five_hundred_count * 500
        calculate3(remainder, one_thousand_count, five_hundred_count)
        
def calculate3(remainder, one_thousand_count, five_hundred_count):
        one_hundred_count = remainder / 100
        print_result(one_thousand_count, five_hundred_count, one_hundred_count)
        
def print_result(one_thousand_count=0, five_hundred_count=0, one_hundred_count=0):
    print '%s %s %s' % (one_hundred_count, five_hundred_count, one_thousand_count)

while True:
    A, B = map(int, raw_input().split())
    if A == 0 and B == 0: break
    calculate1()

Submission status: Accepted

Solution code:
while 1:
    b,c=map(int,(input().split()))
    if b==0:break
    d,b=divmod(c-b,1000)
    e,b=divmod(b,500)
    print(b//100,e,d)

Submission status: Accepted

Solution code:
while True:
  a,b= map(int,raw_input().split())
  if a== 0 and b ==0: break
  c=b-a
  ans,ans2,ans3=0,0,0
  while c>=1000:
    c-=1000
    ans+=1
  while c>=500:
    c-=500
    ans2+=1
  while c>=100:
    c-=100
    ans3+=1
  else:
    print ans3,ans2,ans

Submission status: Accepted

Solution code:
while True:
    A,B=map(int,raw_input().split())
    if A==B==0:break
    t=B-A
    L=[1000,500,100]
    T=[]
    for i in range(len(L)):
        T.append(t/L[i])
        t%=L[i]
    print "%d %d %d"%(T[2],T[1],T[0])

Submission status: Accepted

Solution code:
while True:
	a, b = [int(n) for n in raw_input().split()]
	if a == 0 and b == 0: break
	x = b - a
	res = []
	for c in (1000, 500, 100):
		res += [str(int(x / c))]
		x %= c
	print " ".join(reversed(res))

Submission status: Accepted

Solution code:
import sys

def solve():
    while True:
        v,m = map(int,raw_input().split())
        if [v,m] == [0,0]:
	    return
	r1,r5,r10 = 0,0,0
	re = m - v
	r10 = re / 1000
	re %= 1000
	r5 = re	/ 500
	re %= 500
	r1 = re	/ 100
	print str(r1) +	" " + str(r5) +	" " + str(r10)



if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
while 1:
	a,b = map(int,raw_input().split())
	if a == 0: break
	c = b-a
	t = c/1000
	f = (c-1000*t)/500
	h = (c-1000*t-500*f)/100
	print h,f,t

Submission status: Accepted

Solution code:
while True :
    a, b = map(int, input().split())
    if a == 0 and b == 0 :
        break
    
    cost = b - a
    ans_1000 = cost // 1000
    cost = cost % 1000
    ans_500 = cost // 500
    cost = cost % 500
    ans_100 = cost // 100
    print(ans_100, ans_500, ans_1000)

Submission status: Accepted

Solution code:
while True: #永遠にループをする
    a = b = c = 0 #変数の初期化
    i,j = map(int,input().split()) #標準入力
    if i == 0 and j == 0:break #入力値が両方0ならループを終了する
    else: #そうでなければ
        j -= i #差額を計算する
        a = j // 1000 #1000円札の必要枚数を計算する
        b = (j - a * 1000) // 500 #500円の必要枚数を計算する
        c = (j - a * 1000 - b * 500) // 100 #100円の必要枚数を計算する
        print(str(c) + " " + str(b) + " " + str(a)) #出力

Submission status: Accepted

Solution code:
while 1:
    a, b = [int(i) for i in input().split()]
    if a == 0 and b == 0:
        break
    n = b - a
    t = n // 1000
    n = n % 1000
    f = n // 500
    n = n % 500
    h = n // 100
    print(h, f, t)

Submission status: Accepted

Solution code:
while True :
    A, B = map(int, input().split())
    if(A == 0) :
        break
    else :
        C = [0, 0, 0]
        s = B - A
        C[2] = s // 1000
        C[1] = (s - C[2] * 1000) // 500
        C[0] = (s - (C[2] * 1000 + C[1] * 500)) // 100
        
        print(C[0], C[1], C[2])

Submission status: Accepted

Solution code:
while 1:
    a,b=map(int,input().split())
    if a==b==0:break
    c=b-a
    print((c%500//100),c%1000//500,c//1000)

Submission status: Accepted

Solution code:
while True:
    a, b = map(int, input().split())
    if(b == 0):
        break
    b -= a
    print(" ".join([str(x) for x in [b%500//100, b%1000//500, b//1000]]))

Submission status: Accepted

Solution code:
while True:
  a, b = map(int, input().split())
  if a == 0:
    break
  s, a = divmod(b-a, 1000)
  f, a = divmod(a, 500)
  print(a//100, f, s)

Submission status: Runtime Error

Solution code:
A,B = input().split()
A = int(A)
B = int(B)
if A == 0:
    return
oturi = B - A
B1 = 0
C5 = 0
C1 = 0
if oturi/1000 >= 1:
    B1+= int(oturi/1000)
    oturi = oturi-(B1*1000)
if oturi % 500 == 0:
    oturi = int(oturi)

while oturi >= 500:
    oturi-=500
    C5+=1
while oturi > 0:
    oturi-=100
    C1+=1
print(C1,C5,B1)

Submission status: Runtime Error

Solution code:
A,B = input().split()
A = int(A)
B = int(B)
if A == 0:
    return 0
oturi = B - A
B1 = 0
C5 = 0
C1 = 0
if oturi/1000 >= 1:
    B1+= int(oturi/1000)
    oturi = oturi-(B1*1000)
if oturi % 500 == 0:
    oturi = int(oturi)

while oturi >= 500:
    oturi-=500
    C5+=1
while oturi > 0:
    oturi-=100
    C1+=1
print(C1,C5,B1)