怎么写
查看原帖
怎么写
856983
lined_array楼主2024/9/7 13:04

超时了,该怎么写?

#include<bits/stdc++.h>
using namespace std;
int n;
int f(int s){
	if(s>n) return 0;
	else if(s==n){
		return 1;
	}
	return f(s+1)+f(s+2);
}
int main()
{
	cin>>n;
	cout<<f(0);
	return 0;
}

2024/9/7 13:04
加载中...