309916: CF1759D. Make It Round

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Make It Round

题意翻译

## 题目描述 给定 $n$ 和 $m$, 我们可以把 $n$ 变为 $n\cdot k(1\leq k\leq m,k∈N^{*})$, 请输出末尾 $0$ 的个数最多的 $n\cdot k$。 - 例如, $481000$ 比 $1000010$ 末尾 $0$ 的个数更多。 - 如果有多个末尾 $0$ 个数最多的 $n\cdot k$, 则输出其中最大的一个。 - 如果不存在末尾 $0$ 个数更多的 $n\cdot k$, 则输出 $n\cdot m$。 ## 输入格式 第一行输入一个整数 $t\ (1\leq t \leq 10^4)$, 表示数据组数。 之后的 $t$ 行,每行包含两个整数 $n$, $m\ (1\leq n,m \leq 10^9)$。 ## 输出格式 对于每组数据,输出末尾 $0$ 的个数最多的 $n\cdot k\ (1\leq k\leq m,k∈N^{*})$。 如果有多个末尾 $0$ 个数最多的 $n\cdot k$, 则输出其中最大的一个。 如果不存在末尾 $0$ 个数更多的 $n\cdot k$, 则输出 $n\cdot m$。 ## 样例解释 在第一组数据中 $n=6,m=11$, 我们无法得到一个末尾有两个 $0$ 的数,因此我们令 $k=10$, 输出 $6\cdot 10=60$。(它的末尾有 $1$ 个 $0$, 且它比 $30$ 更大) 在第三组数据中 $n=13,m=5$, 所有可能的 $n\cdot k$ 末尾都没有 $0$, 因此我们输出 $n\cdot m=65$。

题目描述

Inflation has occurred in Berlandia, so the store needs to change the price of goods. The current price of good $ n $ is given. It is allowed to increase the price of the good by $ k $ times, with $ 1 \le k \le m $ , k is an integer. Output the roundest possible new price of the good. That is, the one that has the maximum number of zeros at the end. For example, the number 481000 is more round than the number 1000010 (three zeros at the end of 481000 and only one at the end of 1000010). If there are several possible variants, output the one in which the new price is maximal. If it is impossible to get a rounder price, output $ n \cdot m $ (that is, the maximum possible price).

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \le t \le 10^4 $ ) —the number of test cases in the test. Each test case consists of one line. This line contains two integers: $ n $ and $ m $ ( $ 1 \le n, m \le 10^9 $ ). Where $ n $ is the old price of the good, and the number $ m $ means that you can increase the price $ n $ no more than $ m $ times.

输出格式


For each test case, output on a separate line the roundest integer of the form $ n \cdot k $ ( $ 1 \le k \le m $ , $ k $ — an integer). If there are several possible variants, output the one in which the new price (value $ n \cdot k $ ) is maximal. If it is impossible to get a more rounded price, output $ n \cdot m $ (that is, the maximum possible price).

输入输出样例

输入样例 #1

10
6 11
5 43
13 5
4 16
10050 12345
2 6
4 30
25 10
2 81
1 7

输出样例 #1

60
200
65
60
120600000
10
100
200
100
7

说明

In the first case $ n = 6 $ , $ m = 11 $ . We cannot get a number with two zeros or more at the end, because we need to increase the price $ 50 $ times, but $ 50 > m = 11 $ . The maximum price multiple of $ 10 $ would be $ 6 \cdot 10 = 60 $ . In the second case $ n = 5 $ , $ m = 43 $ . The maximum price multiple of $ 100 $ would be $ 5 \cdot 40 = 200 $ . In the third case, $ n = 13 $ , $ m = 5 $ . All possible new prices will not end in $ 0 $ , then you should output $ n \cdot m = 65 $ . In the fourth case, you should increase the price $ 15 $ times. In the fifth case, increase the price $ 12000 $ times.

Input

题意翻译

## 题目描述 给定 $n$ 和 $m$, 我们可以把 $n$ 变为 $n\cdot k(1\leq k\leq m,k∈N^{*})$, 请输出末尾 $0$ 的个数最多的 $n\cdot k$。 - 例如, $481000$ 比 $1000010$ 末尾 $0$ 的个数更多。 - 如果有多个末尾 $0$ 个数最多的 $n\cdot k$, 则输出其中最大的一个。 - 如果不存在末尾 $0$ 个数更多的 $n\cdot k$, 则输出 $n\cdot m$。 ## 输入格式 第一行输入一个整数 $t\ (1\leq t \leq 10^4)$, 表示数据组数。 之后的 $t$ 行,每行包含两个整数 $n$, $m\ (1\leq n,m \leq 10^9)$。 ## 输出格式 对于每组数据,输出末尾 $0$ 的个数最多的 $n\cdot k\ (1\leq k\leq m,k∈N^{*})$。 如果有多个末尾 $0$ 个数最多的 $n\cdot k$, 则输出其中最大的一个。 如果不存在末尾 $0$ 个数更多的 $n\cdot k$, 则输出 $n\cdot m$。 ## 样例解释 在第一组数据中 $n=6,m=11$, 我们无法得到一个末尾有两个 $0$ 的数,因此我们令 $k=10$, 输出 $6\cdot 10=60$。(它的末尾有 $1$ 个 $0$, 且它比 $30$ 更大) 在第三组数据中 $n=13,m=5$, 所有可能的 $n\cdot k$ 末尾都没有 $0$, 因此我们输出 $n\cdot m=65$。

加入题单

算法标签: