码住,改天写题解……
#include<iostream>
#include<cstdio>
#include<algorithm>
#define LL long long
using namespace std;
const int MAXN = 1000 + 50;
LL n,m,k,f[MAXN];
LL ans;
int calc(int p,int q){
if(p == q)return p;
if(p < q)swap(p,q);
//printf("p=%d q=%d\n",p,q);
return calc(q,p - q);
}
void check(LL x,LL y){
for(int i = 0;i < 70;i ++)
{
if(f[i] * x % f[i + 1] == 0)
ans = max(ans,(x - calc(x,f[i] * x / f[i + 1]))* y);
}
}
int main(){
freopen("cut.in", "r", stdin);
freopen("cut.out", "w", stdout);
scanf("%d%d",&n,&m);
f[0] = 1;f[1] = 1;
for(int i = 1;i <= 70;i ++)
f[i] = f[i - 1] + f[i - 2];
check(n,m);check(m,n);
printf("%lld",ans);
return 0;
}


被折叠的 条评论
为什么被折叠?



