c++50分
  • 板块P1255 数楼梯
  • 楼主dsy2022
  • 当前回复6
  • 已保存回复6
  • 发布时间2023/6/29 15:24
  • 上次更新2023/11/3 12:09:25
查看原帖
c++50分
809643
dsy2022楼主2023/6/29 15:24
#include <bits/stdc++.h>
using namespace std;
long long dfs(int x){
	if(x==2) return 2;
	if(x==1) return 1;
	return dfs(x-1)+dfs(x-2);
}
int main(){
	int x;
	cin>>x;
	cout<<dfs(x);
	return 0;
}
2023/6/29 15:24
加载中...