Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
14413 毕潇天 汉诺塔问题 C++ Accepted 0 MS 256 KB 323 2023-04-14 15:40:15

Tests(1/1):


#include <bits/stdc++.h> using namespace std; void h(int m,char p,char q,char s){ if(m==1){ cout << p << "->1->" << q << endl; }else{ h(m-1,p,s,q); cout << p << "->" << m << "->" << q << endl; h(m-1,s,q,p); } } int main(){ int n; char p,q,s; cin >> n >> p >> q >> s; h(n,p,q,s); return 0; }


Judgement Protocol: