题解 | #小乐乐与欧几里得#
小乐乐与欧几里得
https://www.nowcoder.com/practice/da13e0cf321e4df9acd0fdf0a433cbb0
using System; public class Program { public static void Main() { string[] s = Console.ReadLine().Split(" "); Console.WriteLine(GCD(long.Parse(s[0]), long.Parse(s[1])) + FindLCM(long.Parse(s[0]), long.Parse(s[1]))); } public static long GCD(long a,long b) { if(b == 0) { return a; } long temp = b; b = a % b; a = temp; return GCD(a, b); } public static long FindLCM(long a,long b) { return Math.Abs(a*b)/GCD(a,b); } }