Skip to content

Instantly share code, notes, and snippets.

@sakapon
Created June 2, 2021 01:43
Show Gist options
  • Save sakapon/637de74adc35c56c3912b236687c1aa1 to your computer and use it in GitHub Desktop.
Save sakapon/637de74adc35c56c3912b236687c1aa1 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q038
using System;
class Q038
{
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
static (long, long) Read2L() { var a = ReadL(); return (a[0], a[1]); }
static void Main() => Console.WriteLine(Solve());
static object Solve()
{
var (a, b) = Read2L();
var ag = a / Gcd(a, b);
if (ag > long.MaxValue / b) return "Large";
var l = ag * b;
if (l > 1000000000000000000) return "Large";
return l;
}
static long Gcd(long a, long b) { for (long r; (r = a % b) > 0; a = b, b = r) ; return b; }
}
@sakapon
Copy link
Author

sakapon commented Jun 2, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment