A - k-rounding

A - k-rounding

[原题链接]

思路

\(n\)\(10^k\)的最小公倍数

最小公倍数和最大公因数的关系

\(a \cdot b = 最小公倍数 \cdot 最大公因数\)

代码

点击查看代码
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;

#define X first
#define Y second

typedef pair<int,int> pii;
typedef long long LL;
const char nl = '\n';
const int N = 1e6+10;
const int M = 2e5+10;
int n,m;

int gcd(int a,int b){
	return ((b == 0) ? a : gcd(b,a%b));
}

void solve(){
	cin >> n >> m;
	cout << n * (LL)pow(10,m) / gcd(n,(int)pow(10,m));

}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);

	solve();
}
posted @ 2023-02-19 13:01  Keith-  阅读(10)  评论(0编辑  收藏  举报