题解

1 条题解

  • 0
    @ 2017-10-05 18:31:36

    #include<bits/stdc++.h>
    using namespace std;
    long long n, m;
    long long fib[100];
    long long calc(long long a, long long b)
    {
    if (a == b) return a;
    if (a < b) swap(a, b);
    return calc(b, a - b);
    }

    long long check(long long x, long long y)
    {
    fib[0] = 1;
    fib[1] = 1;
    for(int i = 2; i < 75; i++) fib[i] = fib[i - 1] + fib[i - 2];
    long long res = 0;
    for(int i = 1; i < 70; i++)
    {
    if (x * fib[i] % fib[i+1] == 0)
    {
    long long z=x*fib[i]/fib[i+1];
    res = max(res, (x-calc(x, z)) * y);
    }
    }
    return res;
    }
    int main()
    {
    scanf("%lld%lld", &n, &m);
    printf("%lld\n", max(check(n, m), check(m, n)));
    }

  • 1

信息

难度
9
分类
(无)
标签
(无)
递交数
5
已通过
1
通过率
20%
上传者