问:求n层汉诺塔至少需要多少步完成。
#include<stdio.h> int f(int n); int main() { int n; scanf("%d",&n); printf("%d层汉诺塔至少需要%d步 ",n,f(n)); return 0; } int f(int n) { if(n==1) return 1; else return 2*f(n-1)+1; }