exam8.3

rank25凉凉好吧。。。。。。
T1:。。。
        一开始完全**
        手玩给的那张图(不放图,我太饿把图吃了)
        发现对于任一个节点,减去上一个比他小的斐波那契数就是父节点,
        于是,欢乐敲代码(话说别人好像是二分查找,而我直接打表+lower_bound,<algorithm>大法好)
        过编译,于是……
        样例死了。绝望.png
        一个小时后,过了。
        结果MLE80好吧。

  代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define int long long
#define cin(a)		scanf("%lld",&a)
#define cout1(a)	printf("%lld\n",a)
#define cout2(a)	printf("%lld ",a)
int a[65]={1,1};
int f[600050][65];
int m,n;
void pre()
{
	for(int q=2;q<=64;q++)
		a[q]=a[q-1]+a[q-2];
}
int tot;
int work(int x,int y)
{
	if(x==y)
		return x;
	int dx,dy;
	int tx=x,ty=y;
	int k1=++tot,k2=++tot;
	f[k1][0]=x,f[k2][0]=y;
	for(int q=1;;q++)
	{
		if(tx==1)
		{
			dx=q;
			break;
		}
		int l=lower_bound(a+1,a+64,tx)-a;
		if(tx<=a[l])	--l;
		f[k1][q]=tx-a[l];
		tx-=a[l];
	}
	for(int q=1;;q++)
	{
		if(ty==1)
		{
			dy=q;
			break;
		}
		

转载于:https://www.cnblogs.com/ooovooo/p/11294401.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值