Codeforces Round #434 (Div. 2)

 

codeforces 858A. k-rounding【水】

题意:已知n和k,求n的最小倍数x,要求x后缀至少有k个0。

题解:答案就是10^k和n的最小公倍数。

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 #include<cmath>
 5 using namespace std;
 6 typedef long long ll;
 7 ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
 8 int main() {
 9     ll n, k, s=1;
10     scanf("%lld %lld", &n, &k);
11     while(k--) s *= 10;
12     ll t = gcd(n, s);
13     printf("%lld\n", n / t * s);
14     return 0;
15 }
15ms

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2021-10-29
  • 2021-11-28
  • 2021-06-05
  • 2022-12-23
猜你喜欢
  • 2022-01-13
  • 2021-09-29
  • 2021-09-16
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案