【算法】欧几里德算法
#include<cstdio> int gcd(int a,int b) {return b==0?a:gcd(b,a%b);} int main() { int a,b; scanf("%d%d",&a,&b); printf("%lld",1ll*a*b/gcd(a,b)); return 0; }
时间: 2025-01-02 17:49:53
【算法】欧几里德算法
#include<cstdio> int gcd(int a,int b) {return b==0?a:gcd(b,a%b);} int main() { int a,b; scanf("%d%d",&a,&b); printf("%lld",1ll*a*b/gcd(a,b)); return 0; }