1. 程式人生 > >[Codeplus 2017] 晨跑

[Codeplus 2017] 晨跑

href color pro dep tar scan ble amp php

[題目鏈接]

https://www.lydsy.com/JudgeOnline/problem.php?id=5105

[算法]

答案為三個數的最小公倍數

[代碼]

#include<bits/stdc++.h>
using namespace std;

long long gcd(long long a,long long b)
{
    if (b == 0) return a;
    else return gcd(b,a % b);
}

int main()
{
    
    long long a,b,c;
    scanf(
"%lld%lld%lld",&a,&b,&c); long long d = a * b / gcd(a,b); printf("%lld\n",c * d / gcd(c,d)); return 0; }

[Codeplus 2017] 晨跑