河内塔解决方案

#include<iostream>using namespace std;int main(){while(1){ int n; void henei(int a,char one,char two,char three);cout<<"你要求几块的河内塔"<<endl;cin>>n;henei(n,'A','B','C');}return 0;}void henei(int a,char one,char two,char three){void move(char x,char y);if(a==1)move(one,three);else{henei(a-1,one,three,...
默认分类 | 2008-10-17 17:52 | 阅读 3014 次 | 评论 0 条
浏览3014次
文章分类
文章归档
最新评论