cpp/math/gcd-lcm.cpp
- View this file on GitHub
- Last update: 2024-01-29 16:29:11+09:00
Required by
Code
template <typename T>
T gcd(T a,T b){
if(a%b==0)return b;
else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
return a/gcd(a,b)*b;
}
#line 1 "cpp/math/gcd-lcm.cpp"
template <typename T>
T gcd(T a,T b){
if(a%b==0)return b;
else return gcd(b,a%b);
}
template <typename T>
T lcm(T a,T b){
return a/gcd(a,b)*b;
}