标签:哈尔滨
hanoi塔:
原题大意我就不说明了,大家懂得
#include<stdio.h> void move(int n,char x,char y) { printf("move %d from %c to %c\n",n,x,y); } int hanoi(int n,char x,char y,char z) { if(n==1) move(1,x,z); else { hanoi(n-1,x,z,y); move(n,x,z); hanoi(n-1,y,x,z); } } int main() { int n; char x='a',y='b',z='c'; scanf("%d",&n); hanoi(n,x,y,z); return 0; }
标签:哈尔滨
原文地址:http://blog.csdn.net/qq_17502787/article/details/41622329