問題一覧 > 通常問題

No.2681 Currency Exchange at the Game Center

レベル : / AI推定難易度 : 650 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 126
作問者 : sakuraajisai / テスター : SPD_9X2 👑 rin204 だれ kyawa ma_tw Anpo13211 Haowen Li 尾崎里紗
お気に入りにしたユーザー ProblemId : 10449 / 自分の提出
問題文最終更新日: 2024-03-20 22:58:37
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 422 (第1回 競技プログラミング講習会作問企画コンテスト) (順位表) の他の問題:

Problem Statement

You hold $Y$ Japanese yen in such a way that the number of pieces of currency you hold is minimized.
To play at a game center, you want at least $C$ 100-yen coins.
So you have decided to make exchanges by using a change machine one or more times.
When you insert one piece of currency worth 500 yen or more (say, worth $X$ yen) into this machine, you can receive any combination of currency totaling $X$ yen that is made up of 100-yen coins and 500-yen coins.
Example: Insert a 5000-yen bill. Receive 25 100-yen coins and 5 500-yen coins.

First, determine whether it is possible to obtain $C$ or more 100-yen coins, and if it is not possible, print can't exchange.
Otherwise, determine whether you need to use the change machine one or more times, and if you do not need to, print no exchange.
Otherwise, print the minimum possible number of 100-yen coins you hold after making exchanges so that the condition is satisfied.

The available types of currency are 1 yen, 5 yen, 10 yen, 50 yen, 100 yen, 500 yen, 1000 yen, 2000 yen, 5000 yen, and 10000 yen.

Input

$C\ Y$

  • All inputs are integers
  • $0 \le C \le 10^7$
  • $0 \le Y \le 10^9$

Output

Print a newline at the end.

Sample

Sample 1
Input
1 1234
Output
no exchange

Sample 2
Input
5 500
Output
5

Sample 3
Input
1 99
Output
can't exchange

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。