package 递归;
public class 汉诺塔 {
public static int count=0;
public static void main(String[] args) {
// TODO Auto-generated method stub
String A="A";
String B="B";
String C="C";
Hannuota(3, A, B, C);
System.out.println(count);
}
public static void Hannuota(int n,String A,String B,String C)
{
if(n==1)
{
System.out.println(A+"->"+C);
count++;
return;
}
Hannuota(n-1,A,C,B);
System.out.println(A+"->"+C);
count++;
Hannuota(n-1,B,A,C);
return;
}
}