Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
333928 孙一铭 【C6-6】汉诺塔 C++ 编译错误 0 0 MS 0 KB 470 2025-07-17 09:22:13

Tests(0/0):


#include<bits/stdc++.h using namespace std; int h(int n, char s, char d, char t) { int s1 = 0; if (n == 1) { cout << s << "->" << d << endl; return 1; } s1 += hanoi(n-1, s, t, d); cout << s << "->" << d << endl; s1++; s1 += hanoi(n-1, t, d, s); return s1; } int main() { int n; cin >> n; for(int i=1;i<=n;i++){ cout<<i<<":"; cout <<h(n, 'a', 'c', 'b'); } return 0; }


测评信息: