Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
12351 A班-袁誉晏 汉诺塔的移动次数 C++ 运行出错 0 0 MS 260 KB 315 2025-07-10 15:04:12

Tests(0/1):


#include <bits/stdc++.h> using namespace std; int temp=0; int move(int n,char a,char b,char c) { if(n==0) { return 0; } else { move(n-1,a,b,c); temp++; move(n-1,b,a,c); } } int main() { int n; char a='A',b='B',c='C'; cin>>n; move(n,a,b,c); cout<<temp<<endl; return 0; }


测评信息: