40分,求解哈在线等挺急的
查看原帖
40分,求解哈在线等挺急的
1037310
jfm0211楼主2023/8/20 17:11

40分,样例过了

#include <iostream>
#include <cstdio>
#include <map>
#include <vector>
#include <set>
using namespace std;
int gcd(int a,int b){
	int k;
	while(b>0){
		k=a%b;
		a=b;
		b=k;
	}
	return a;
}
int lcm(int a,int b){
	return a*b/gcd(a,b);
}
int main(){
	int a,b;
	cin>>a>>b;
	cout<<gcd(a,b)<<" "<<lcm(a,b);
	return 0;
} 

各位大佬帮帮忙行不行啊!!

2023/8/20 17:11
加载中...