走10级楼梯题目解法
来源:互联网 发布:一句话网络段子精选 编辑:程序博客网 时间:2024/05/17 21:45
#include <bits/stdc++.h>using namespace std;//递归 int handle1(int N){if(N == 1) return 1;if(N == 2) return 2;if(N > 2){return handle1(N-1)+handle1(N-2);}return 0;}//斐波那契数列 int handle2(int n){n = n + 1;return (1/sqrt(5))*(pow((1+sqrt(5))/2,n)-pow((1-sqrt(5))/2,n)) ;}int main(){int N;while(scanf("%d",&N)!=EOF){ printf("%d\n",handle1(N));printf("%d\n",handle2(N));}return 0;}
0 0
- 走10级楼梯题目解法
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 走楼梯
- 楼梯台阶问题解法
- 走楼梯问题
- 楼梯的走法
- 走楼梯问题
- SDUT2876_走楼梯(大数)
- Problem 1031 - 走楼梯
- 动态规划走楼梯
- SDUT OJ 走楼梯
- 我的英文博客
- 循环队列的实现
- Android的Drawable
- react-native创建searchbar
- git 常用命令总结
- 走10级楼梯题目解法
- mongodb3更新数据java.lang.IllegalArgumentException: Invalid BSON field name _id
- java常用算法之螺旋矩阵
- href="javascript:xxx(this);"和onclick="javascript:xxx(this);"的区别
- Android 蓝牙设备与手机之间的数据传输
- dataTable 批量选中 当前页的所有列表数据
- js变量提升
- 【微信扫码登录】以及【微信扫码支付】解决方案
- 函数理解