For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10and is divisible by n.
For example, 4-rounding of 375 is 375·80 = 30000. 30000 is the minimum integer such that it ends with 4 or more zeros and is divisible by 375.
Write a program that will perform the k-rounding of n.
Input
The only line contains two integers n and k (1 ≤ n ≤ 109, 0 ≤ k ≤ 8).
Output
Print the k-rounding of n.
Examples
input
375 4
output
30000
input
10000 1
output
10000
input
38101 0
output
38101
input
123456789 8
output
12345678900000000
玩玩没想到啊 ,这题竟然是求10^k与n的最小公倍数。。。
可怜我想偏了,还wa了俩发才过T T。
附事后ac代码:
1 #include <cstdio>
2 #include <iostream>
3 #include <cmath>
4#define ll long long
5ll gcd(ll a,ll b) {
6return a?gcd(b%a,a):b;
7}
8int main() {
9 ll n,k;
10 scanf("%lld %lld",&n,&k);
11 k = pow(10,k);
12 printf("%lld\n",n*(k/gcd(k,n)));
13return0;
141516 }