diff --git "a/\352\271\200\354\261\204\354\234\244/0621/Solution_p70129_\354\235\264\354\247\204\353\263\200\355\231\230\353\260\230\353\263\265\355\225\230\352\270\260.java" "b/\352\271\200\354\261\204\354\234\244/0621/Solution_p70129_\354\235\264\354\247\204\353\263\200\355\231\230\353\260\230\353\263\265\355\225\230\352\270\260.java" index b324146..5251a32 100644 --- "a/\352\271\200\354\261\204\354\234\244/0621/Solution_p70129_\354\235\264\354\247\204\353\263\200\355\231\230\353\260\230\353\263\265\355\225\230\352\270\260.java" +++ "b/\352\271\200\354\261\204\354\234\244/0621/Solution_p70129_\354\235\264\354\247\204\353\263\200\355\231\230\353\260\230\353\263\265\355\225\230\352\270\260.java" @@ -1,5 +1,6 @@ package vac; + public class Solution_p70129_이진변환반복하기 { public int[] solution(String s) { diff --git "a/\352\271\200\354\261\204\354\234\244/0628/Solution_b2229_\354\241\260\354\247\234\352\270\260.java" "b/\352\271\200\354\261\204\354\234\244/0628/Solution_b2229_\354\241\260\354\247\234\352\270\260.java" new file mode 100644 index 0000000..05d6b51 --- /dev/null +++ "b/\352\271\200\354\261\204\354\234\244/0628/Solution_b2229_\354\241\260\354\247\234\352\270\260.java" @@ -0,0 +1,31 @@ +package vac; + +import java.util.*; +import java.io.*; + +public class Solution_b2229_조짜기 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int N = sc.nextInt(); + int[] arr = new int[N + 1]; + int[] dp = new int[N + 1]; + int RV = 0; //최적값 + int MAX = 0; //가장 높은 값 + dp[0] = 0; //자기자신 + dp[1] = 0; //자기자신 + + for (int i = 1; i <= N; i++) { + arr[i] = sc.nextInt(); + + for (int j = i - 1; j >= 1; j--) { + MAX = Math.max(MAX, Math.abs(arr[i] - arr[j]) + dp[j - 1]); + } + + dp[i] = MAX; + RV = dp[i]; + } + System.out.println(RV); + } +} \ No newline at end of file