結果

問題 No.2681 ゲームセンターの両替
ユーザー timi
提出日時 2024-03-20 21:18:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 361 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 81,704 KB
実行使用メモリ 53,892 KB
最終ジャッジ日時 2024-10-05 04:03:56
合計ジャッジ時間 1,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

C,Y=map(int, input().split())
#A=list(map(int, input().split()))
D=[10000,5000,2000,1000,500,100,50,10,5,1]
E=[]
for d in D:
  c=Y//d
  E.append(c)
  Y-=d*c
#print(E) 
c=0
if E[5]>=C:
  print('no exchange')
  exit()
for i in range(len(D)):
  if D[i]>=100:
    c+=(D[i]//100)*E[i]
if c<C:
  print("can't exchange")
  exit()
c=E[5]
d=(C-c-1)//5+1
print(E[5]+5*d)
0