Jinsoo

用更相减损术写的

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define int long long
using namespace std;
long long a,b,c;

long long gcd(int x,int y){
	long long ans=1;
	while(x%2==0&&y%2==0){
		x/=2;
		y/=2;
		ans*=2;
	}
	while(x%2==0){
		x/=2;
	}
	while(y%2==0){
		y/=2;
	}
	while(x!=y){
		if(x>y) x-=y;
		else
		y-=x;
	}
	return x*ans;
}
signed main(){
	scanf("%d%d%d",&a,&b,&c);
	int d=gcd(a,b);
	long long e=a*b/d;
	long long f=e*c/(gcd(e,c));
	cout<<f;
	return 0;
}

相关文章:

  • 2022-02-14
  • 2021-11-27
  • 2022-12-23
  • 2021-12-20
  • 2021-11-30
  • 2022-12-23
  • 2021-06-15
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-12-13
  • 2021-12-07
相关资源
相似解决方案