#include
#include
int main()
{
std::cout << std::gcd( 0, 10) << " "; // 10
std::cout << std::gcd( 1, 10) << " "; // 1
std::cout << std::gcd( 2, 10) << " "; // 2
std::cout << std::gcd( 3, 10) << " "; // 1
std::cout << std::gcd( 4, 10) << " "; // 2
std::cout << std::gcd( 5, 10) << " "; // 5
std::cout << std::gcd( 6, 10) << " "; // 2
std::cout << std::gcd( 7, 10) << " "; // 1
std::cout << std::gcd( 8, 10) << " "; // 2
std::cout << std::gcd( 9, 10) << " "; // 1
std::cout << std::gcd(10, 10) << " "; // 10
std::cout << ": ";
std::cout << std::lcm( 0, 10) << " "; // 0
std::cout << std::lcm( 1, 10) << " "; // 10
std::cout << std::lcm( 2, 10) << " "; // 10
std::cout << std::lcm( 3, 10) << " "; // 30
std::cout << std::lcm( 4, 10) << " "; // 20
std::cout << std::lcm( 5, 10) << " "; // 10
std::cout << std::lcm( 6, 10) << " "; // 30
std::cout << std::lcm( 7, 10) << " "; // 70
std::cout << std::lcm( 8, 10) << " "; // 40
std::cout << std::lcm( 9, 10) << " "; // 90
std::cout << std::lcm(10, 10) << " "; // 10
std::cout << std::endl;
return 0;
}
// Output: 10 1 2 1 2 5 2 1 2 1 10 : 0 10 10 30 20 10 30 70 40 90 10
References:http://en.cppreference.com/w/cpp/numeric/gcd
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0295r0.pdf
No comments:
Post a Comment