logo AlgoBeat OnlineJudge
登录 注册

#207490. [ICPC 2020 WF] Trailing Digits

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

ICPC2020 WF M


A large shipment of doodads has just arrived, and each doodad has a suggested retail price of cents. You've noticed that consumers are much more likely to purchase goods when most of the trailing digits are the same. For example, items are more likely to be priced at cents rather than cents. So to make your goods more appealing, you've decided to sell your goods in bundles. To make a bundle, you choose a positive integer , and sell doodads for cents. With an appropriate choice of you can have a more pleasing price. For example, selling -cent doodads in bundles of size means that each bundle sells for cents, which has two trailing s, rather than no trailing s of . This idea of trailing s can be generalized to any other trailing digit: bundles of -cent doodads sell for cents (three trailing s) and bundles of one million doodads sell for cents (six trailing s).

After a little thought, you realize that you do not want to make your bundles too large---not only can the price be excessive, but who really needs several million doodads? For any type of doodad, your marketing department has a maximum bundle price of .

Given the price of a doodad, the desired trailing digit, and the maximum price of a bundle, write a program that optimizes the trailing digits.

输入格式

Input consists of a single line containing three integers , , and , where () is the price of a doodad in cents, () is the desired trailing digit, and () is the maximum price of a bundle.

输出格式

Output the maximum number of consecutive occurrences of that can appear at the end of a bundle price, given that the price of the bundle cannot exceed .

样例

样例输入 1

57 9 1000

样例输出 1

2

样例输入 2

57 4 40000

样例输出 2

3

样例输入 3

57 4 39000

样例输出 3

2