Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
12387 D班-西瓜 汉诺塔的移动次数 C++ 通过 100 1 MS 264 KB 370 2025-07-10 23:43:01

Tests(1/1):


#include <bits/stdc++.h> using namespace std; int temp = 0; void move(int n, char a, char b, char c) { if (n == 0) { return; } move(n - 1, a, c, b); 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; }


测评信息: