Created
June 1, 2021 01:08
-
-
Save sakapon/0594c751783840f86cb3c4463ad6e639 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q022
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q022 | |
{ | |
static void Main() | |
{ | |
var a = Array.ConvertAll(Console.ReadLine().Split(), long.Parse); | |
var g = a.Aggregate(Gcd); | |
Console.WriteLine(a.Sum(x => x / g - 1)); | |
} | |
static long Gcd(long a, long b) { for (long r; (r = a % b) > 0; a = b, b = r) ; return b; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23103460