diff --git "a/YooGyeongMo/DP/RGB\352\261\260\353\246\254.swift" "b/YooGyeongMo/DP/RGB\352\261\260\353\246\254.swift" new file mode 100644 index 0000000..f2ad00e --- /dev/null +++ "b/YooGyeongMo/DP/RGB\352\261\260\353\246\254.swift" @@ -0,0 +1,28 @@ +import Foundation + +// RGB 순으로 N 개의 집이 들어온다. +// 여러 조건이 있지만 단 하나의 조건만 만족하면된다. 현재, 집에서 전,후 집 색과 겹치지만 않으면 된다. +// dp 배열로 현재 좌표에 대한것을 전 좌표 비교후 저장하여 마지막 것만 내면 될듯함. +// 입력값 최대 1000, 재귀보단 반복문 바텀업 ㄱ + +let n = Int(readLine()!)! + +var arr = Array(repeating: Array(repeating:0, count: 3), count: n) // 0 Based Indexing + +var dp = Array(repeating: Array(repeating:0 , count: 3), count: n) + +for i in 0..