zoukankan      html  css  js  c++  java
  • codeforces 858A

    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*(k/gcd(k,n)));
    13     return 0;
    14     
    15     
    16 }
    View Code
  • 相关阅读:
    leetcode
    面试知识点
    关于flock文件锁的阻塞与非阻塞
    cetos7 安装telnet
    github 获取 token
    windows安装composer
    编码问题
    RabbitMQ 关键词解释
    windows下安装rabbitmq以及php扩展amqp
    windows下安装oracle客户端和php扩展
  • 原文地址:https://www.cnblogs.com/zmin/p/7553560.html
Copyright © 2011-2022 走看看