알고리즘&자료구조/재귀호출(2)
-
재귀호출(재귀함수)-하노이 탑(백준1914번)
재귀를 이용한 하노이탑(백준1914번문제) 재귀를 이용한 하노이탑 문제풀이 1234567891011121314151617181920212223242526272829303132333435package recursiveandbacktracking; import java.math.BigInteger;import java.util.Scanner; public class Baekjun1914hanoiRecursive { static void hanoi(int N,char from,char aux,char to) { if(N==1) { System.out.println(from+" "+to); }else { hanoi(N-1,from,to,aux); System.out.println(from+" "+to); han..
2018.03.09 -
재귀호출(재귀함수)-Z(백준1074번)
재귀함수-백준1074번 Z문제 풀이-재귀호출을 이용한 알고리즘풀이 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859package recursiveandbacktracking; import java.util.Arrays;import java.util.Scanner; public class Baekjun1074ZproblemRecursive { static long count; public static long zRecursive(long powNum,int r,int c) { if(powNum==2) { //2x2일 경우 //1사분면일경우 if(r%powNum=..
2018.03.09