1 条题解
- 
  0
#include<bits/stdc++.h> using namespace std; int n; void hanoi(int num,char start,char mid,char end) { if(num==1) { cout<<start<<"-"<<num<<"-"<<end<<endl; return; } hanoi(num-1,start,end,mid); cout<<start<<"-"<<num<<"-"<<end<<endl; hanoi(num-1,mid,start,end); } int main() { cin>>n; hanoi(n,'A','B','C'); }
 
信息
- ID
 - 2629
 - 时间
 - 1000ms
 - 内存
 - 256MiB
 - 难度
 - 3
 - 标签
 - (无)
 - 递交数
 - 59
 - 已通过
 - 33
 - 上传者