CompetitiveProgramming

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub null0124/CompetitiveProgramming

:heavy_check_mark: gcd-lcm
(kyopro/library/math/gcd_lcm.cpp)

Verified with

Code

/*
* @title gcd-lcm
* @docs kyopro/docs/gcd_lcm.md
*/

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}
#line 1 "kyopro/library/math/gcd_lcm.cpp"
/*
* @title gcd-lcm
* @docs kyopro/docs/gcd_lcm.md
*/

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

ll lcm(ll number1, ll number2) {//lcmを求める
	return number1 / gcd(number1, number2) * number2;
}
Back to top page