codeforces 858A
1 second
256 megabytes
standard input
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.
The only line contains two integers n and k (1 ≤ n ≤ 109, 0 ≤ k ≤ 8).
Print the k-rounding of n.
375 4
30000
10000 1
10000
38101 0
38101
123456789 8
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的更多相关文章
- Codeforces 858A. k-rounding 数论
题目: 题意:输入n和k,找到一个最小的数,满足末尾有至少k个0和是n的倍数. 最小的情况 ans = n,最大的情况 ans = n*pow(10,k). 令 k = pow(10,k); 我们发现 ...
- 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. 题解:答案就是 ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
随机推荐
- printf函数输出格式总结
printf函数格式 函数描述: printf("[格式化字符串]", [参数链表]); 函数声明: int printf(const char *format, ...) ; 输 ...
- Tensorflow-基础使用
Tensorflow基本概念 使用图(graphs)来表示计算任务 在被称之为会话(Session)的上下文(context)中执行图 使用tensor表示数据 通过变量(Variable)维护状态 ...
- 微博CacheService架构浅析 对底层协议进行适配
https://mp.weixin.qq.com/s/wPR0j2bmHBF6z0ZjTlz_4A 麦俊生 InfoQ 2014-04-21 微博作为国内最大的社交媒体网站之一,每天承载着亿万用户的服 ...
- python RecursionError: maximum recursion depth exceeded while calling
import copyimport sys # 导入sys模块sys.setrecursionlimit(8192) # 将默认的递归深度修改为r = sys.getrecursionlimit()_ ...
- "INVALID" is not a valid start token
Search · is not a valid start token https://github.com/prometheus/prometheus/search?q=is+not+a+valid ...
- git commit前检测husky与pre-commit 提交钩子
git commit前检测husky与pre-commit git commit前检测husky与pre-commit - 简书 https://www.jianshu.com/p/f0d31f92b ...
- 像羽毛一样轻的MVVMLight(一)(MVVM 和 MVVMLight简介)
致敬 在此致敬翁智华大佬,感谢大佬为后辈们写下如此详细的文档,本文将在原文基础上添加些自己的理解,希望这样优秀的文档广为流传. 原文请参考 https://www.cnblogs.com/wzh201 ...
- Java——I/O入门相关练习代码
流的概念 读取文件 读取文件1 读取文件2 读取文件3 读取文件4 skip跳过n个字节后再开始读取 读取过程中暂停给当前位置做一个标记下一次从标记位置开始读取 序列流集合流 把三个流添加到集合中合并 ...
- 使用Docker部署监控系统,Prometheus,Grafana,监控服务器信息及Mysql
使用Docker部署监控系统,Prometheus,Grafana,监控服务器信息及Mysql 一.docker部署prometheus监控系统 1.1 配置安装环境 1.1.1 安装promethe ...
- trunk
今天我们一起聊trunk(接vlan之后),一台switch我们用vlan就可以划分vlan(虚拟局域网),但是2台switch该怎么办呢? 实验环境搭建 switch0 : enable //切换到 ...