Hanoi - plus

 

#include <iostream>
using namespace std;
int n,m,k;
int f(int n, int m) {
if (n <= m) return 1;
return f(n - m, m) * 2 + 1;
}
void fun();
int main() {
cin >> n >> m;
cout << f(n, m) << endl;
return 0;
}

posted @ 2023-04-16 10:48  梁家豪123  阅读(18)  评论(0)    收藏  举报