【CF Round 434 A. k-rounding】
Time limit per test1 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 10 and 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
【翻译】输入n,k,求出最小的数满足能够被n整除且末尾至少有k个0。
题解:
①末尾k个0其实就是能够被10k整除。
②问题转化为求n,k最小公倍数,方法是用LCM(a,b)=a*b/GCD(a,b)
#include<math.h>
#include<stdio.h>
#include<algorithm>
#define ll long long
ll n,k,a,b;
int main()
{
scanf("%I64d%I64d",&n,&k);a=n,b=pow(10,k)+0.5;
printf("%I64d\n",a*b/std::__gcd(a,b));return 0;
}//Paul_Guderian
【CF Round 434 A. k-rounding】的更多相关文章
- 【CF Round 434 B. Which floor?】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- 【Codeforces Round #434 (Div. 1) B】Polycarp's phone book
[链接]h在这里写链接 [题意] 给你n个电话号码. 让你给每一个电话号码选定一个字符串s; 使得这个串s是这个电话号码的子串. 且不是任何一个其他电话号码的子串. s要求最短. [题解] 字典树. ...
- 【Codeforces Round #434 (Div. 2) A】k-rounding
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 转换一下就是求n和10^k的最小公倍数. [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++ ...
- 【Codeforces Round #434 (Div. 2) B】Which floor?
[链接]h在这里写链接 [题意] 在这里写题意 [题解] 枚举每层有多少个公寓就好. 要注意,每次都要从1到100判断,一下那个公寓该不该出现在那一层. 多个答案,如果答案是一样的.也算是唯一的. ...
- 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers
[链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...
- 【codeforces】【比赛题解】#861 CF Round #434 (Div.2)
本来是rated,现在变成unrated,你说气不气. 链接. [A]k-凑整 题意: 一个正整数\(n\)的\(k\)-凑整数是最小的正整数\(x\)使得\(x\)在十进制下末尾有\(k\)个或更多 ...
- 【CF Round 429 B. Godsend】
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- 【CF Round 439 E. The Untended Antiquity】
time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standa ...
- 【CF Round 439 C. The Intriguing Obsession】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
随机推荐
- 使用webBrowser进行C#和JS通讯
.前台调用后台: 在webBrowser使用过程中为了C#和js通讯,webBrowser必须设置ObjectForScripting的属性,它是一个object,这个object可以提供给webBr ...
- Python学习:变量
变量(Variables): 是为了存储程序在运算过程中的一些中间结果,为了方便日后调用储存在计算的内存中 官方介绍: Variables are used to storeinformation t ...
- Python学习:3.Python学习基础
Python基础概念 一.编码 Python解释器加载.py文件中的代码的时候,对内容进行编码,在Python2.x中默认使用的是ASCII,因此我们使用Python2.x版本输出中文的时候,会出现以 ...
- 嵌入式linux系统移植(一)
内容: 交叉编译环境 bootloader功能子系统 内核核心子系统 文件系统子系统要点: 搭建交叉编译环境 bootloader的选择和移植 kernel的配置.编译.移植和调 ...
- C errno是否是线程安全的
本文同时发表在https://github.com/zhangyachen/zhangyachen.github.io/issues/138 在使用多线程时,遇到了一个问题:线程例程中如果需要使用er ...
- 分享一个工作中遇得到的sql(按每天每人统计拖车次数与小修次数)
查询每人每天的数据 首先先建表 CREATE TABLE `user` ( `name` ) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CR ...
- 42-EF Core Migration
1-常用命令 1-由于2.1版本有点不一样,不会自动创建ApplicationUser类,发现合并没效果.暂时略 增加一个字段 E:\coding\netcore\IdentitySample> ...
- WebService第一天——概述与入门操作
一.概述 1.是什么 Web service是一个平台独立的,低耦合的,自包含的.基于可编程的web的应用程序,可使用开放的XML(标准通用标记语言下的一个子集)标准来描述.发布.发现.协调和配置这些 ...
- LeetCode:14. Longest Commen Prefix(Easy)
1. 原题链接 https://leetcode.com/problems/longest-common-prefix/description/ 2. 题目要求 给定一个字符串数组,让你求出该数组中所 ...
- Encrypted bootloader (程序BIN文件加密及在线升级)
了解更多关于bootloader 的C语言实现,请加我QQ: 1273623966 (验证信息请填 bootloader),欢迎咨询或定制bootloader(在线升级程序). 在上一个博客随笔,我介 ...