Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
332 B
2
Indexable
Never
//Bai 1
#include <iostream>

using namespace std;

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

int main(){
	freopen("test.inp","r",stdin);
	freopen("test.out","w",stdout);

	int g, n, m; cin >> n >> m;
	g = gcd(n,m);
	cout << g << endl;
	cout << n/g << " " << m/g << endl;

	return 0;
}
Leave a Comment