A. k-rounding
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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
5 ll gcd(ll a,ll b) {
6 return a?gcd(b%a,a):b;
7 }
8 int 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)));
13 return 0;
14
15
16 }

codeforces 858A的更多相关文章

  1. Codeforces 858A. k-rounding 数论

    题目: 题意:输入n和k,找到一个最小的数,满足末尾有至少k个0和是n的倍数. 最小的情况 ans = n,最大的情况 ans = n*pow(10,k). 令 k = pow(10,k); 我们发现 ...

  2. Codeforces Round #434 (Div. 2)【A、B、C、D】

    Codeforces Round #434 (Div. 2) codeforces 858A. k-rounding[水] 题意:已知n和k,求n的最小倍数x,要求x后缀至少有k个0. 题解:答案就是 ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. 05--Docker对DockerFile解析

    一.是什么: 1.1 DockerFile是用来构建Docker镜像的构建文件,是由一系列命令和参数构成的脚本 1.2 构建步骤: 1.2.1 编写Dockerfile文件 1.2.2 docker ...

  2. Spring学习03

    6.Bean的自动装配 6.1 自动装配说明 自动装配是使用spring满足bean依赖的一种方法 spring会在应用上下文中为某个bean寻找其依赖的bean. Spring中bean的三种装配机 ...

  3. 同步与异步 Python 有何不同?

    你是否听到人们说过,异步 Python 代码比"普通(或同步)Python 代码更快?果真是那样吗? 1 "同步"和"异步"是什么意思? Web 应用 ...

  4. JavaScript中的构造函数和原型!

    JavaScript中的原型! 原型的内容是涉及到JavaScript中的构造函数的 每一个构造函数都有一个原型对象!prototype 他的作用是 共享方法!还可以扩展内置对象[对原来的内置对象进行 ...

  5. Bitter.Core系列四:Bitter ORM NETCORE ORM 全网最粗暴简单易用高性能的 NETCore ORM 之 示例 查询

    一: 单表模型驱动查询 如下示例代码演示: // 根据ID 查询: var studentquery = db.FindQuery<TStudentInfo>().QueryById(12 ...

  6. session和cookie自动登录机制

    cookie的存储 cookie是浏览器支持的一种本地存储方式.以dict,键值对方式存储. {"sessionkey": "123"} 浏览器会自动对于它进行 ...

  7. promise有几种状态,什么时候会进入catch

    三个状态:pending.fulfilled.reject两个过程:padding -> fulfilled.padding -> rejected当pending为rejectd时,会进 ...

  8. C# 8.0 可空(Nullable)给ASP.NET Core带来的坑

    Nullable reference types(可为空引用类型) 可为空引用类型不讲武德 C#8.0 引入了"可为空引用类型"和"不可为空引用类型",使我们能 ...

  9. 大白话入门 Spring Cloud

    首先我给大家看一张图,如果大家对这张图有些地方不太理解的话,我希望你们看完我这篇文章会恍然大悟. 什么是Spring cloud 构建分布式系统不需要复杂和容易出错.Spring Cloud 为最常见 ...

  10. docker版mysql的使用和配置(1)——docker的基本操作

    最近实在是忙成狗,其他的内容等稍微闲一点了一起更新. 这篇主要是讲docker版的mysql的使用和配置信息.因为实习公司需要搞一个docker做测试环境用,还需要包括基本的依赖.最重要的是,因为这个 ...