package HanoiExample; public class Hanoi { public static void main(String[] args) { hanotFun("A", "B", "C", 4); } public static void hanotFun(String start, String pass, String end, int num) { //시작지점 start 지나가는 곳 pass 마지막 모이는 곳 end 4개를 옮기겠다 if(num == 1) { //1혼자 남았을 때는 바로 끝으로 옮긴다 System.out.printf(num + ":%s -> %s\n", start, end); } else { hanotFun(start, end, pass, num -1); System.out.printf(num ..
개발일기
2023. 2. 11. 10:52