题解 | #跳台阶扩展问题#
跳台阶扩展问题
https://www.nowcoder.com/practice/953b74ca5c4d44bb91f39ac4ddea0fee
#include <stdio.h> int caln(int n){ if(n < 0){ return -1; } if(n<=1){ return 1; }else{ int count=0; for(int i = 1; i <= n; i++){ count+=caln(n-i); } return count; } } int main() { int a = 7; //2; scanf("%d", &a); printf("%d", caln(a)); return 0; }