MLE求助
查看原帖
MLE求助
1226952
Cosine_Func楼主2024/1/25 13:48

https://www.luogu.com.cn/record/144282269

#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ve vector
#define endl '\n'
#define itn int
using namespace std;
ll n;
bool end=0;
void dfs(ll a,ll b,int k){
	if(end)return;
	if(a==n or b==n){
		cout<<k;
		end=1;
		return;
	}
	dfs(a+b,a,k+1);
	dfs(a,a+b,k+1);
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    //begin
    cin>>n;
    dfs(1,1,0);
	//end
    return 0;
}
2024/1/25 13:48
加载中...