Skip to content

Commit

Permalink
#188 - 2xn 타일링 문제 풀이
Browse files Browse the repository at this point in the history
  • Loading branch information
hwangJi-dev committed Apr 6, 2023
1 parent df3ce57 commit 1c8e5c9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Programmers/Boj/11726_2×n 타일링.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// 11726_2×n 타일링.swift
// Programmers1
//
// Created by hwangJi on 2023/04/06.
//

import Foundation

func solution11726() {
let N = Int(readLine()!)!
var rectangleArr = Array(repeating: 0, count: N + 1)

if N == 1 {
print(1)
} else if N == 2 {
print(2)
} else {
rectangleArr[1] = 1
rectangleArr[2] = 2

for i in 3...N {
rectangleArr[i] = (rectangleArr[i - 1] + rectangleArr[i - 2]) % 10007
}

print(rectangleArr[N])
}
}
4 changes: 4 additions & 0 deletions Programmers/Programmers.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
33D0D94B29DD7FFC00183B04 /* 1463_1로 만들기.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D0D94A29DD7FFC00183B04 /* 1463_1로 만들기.swift */; };
33D0D94D29DD90B900183B04 /* 9095_1, 2, 3 더하기.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D0D94C29DD90B900183B04 /* 9095_1, 2, 3 더하기.swift */; };
33D0D94F29DDF29B00183B04 /* 2579_계단 오르기.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D0D94E29DDF29B00183B04 /* 2579_계단 오르기.swift */; };
33D0D95129DEC03200183B04 /* 11726_2×n 타일링.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33D0D95029DEC03200183B04 /* 11726_2×n 타일링.swift */; };
33DAF47C28F5A62000984D8D /* 할인행사.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DAF47B28F5A62000984D8D /* 할인행사.swift */; };
33DFAE3C2898036B0075DD46 /* 신규 아이디 추천.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DFAE3B2898036A0075DD46 /* 신규 아이디 추천.swift */; };
33DFAE3E28980C360075DD46 /* 키패드 누르기.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33DFAE3D28980C360075DD46 /* 키패드 누르기.swift */; };
Expand Down Expand Up @@ -355,6 +356,7 @@
33D0D94A29DD7FFC00183B04 /* 1463_1로 만들기.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "1463_1로 만들기.swift"; sourceTree = "<group>"; };
33D0D94C29DD90B900183B04 /* 9095_1, 2, 3 더하기.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "9095_1, 2, 3 더하기.swift"; sourceTree = "<group>"; };
33D0D94E29DDF29B00183B04 /* 2579_계단 오르기.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "2579_계단 오르기.swift"; sourceTree = "<group>"; };
33D0D95029DEC03200183B04 /* 11726_2×n 타일링.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "11726_2×n 타일링.swift"; sourceTree = "<group>"; };
33DAF47B28F5A62000984D8D /* 할인행사.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "할인행사.swift"; sourceTree = "<group>"; };
33DFAE3B2898036A0075DD46 /* 신규 아이디 추천.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "신규 아이디 추천.swift"; sourceTree = "<group>"; };
33DFAE3D28980C360075DD46 /* 키패드 누르기.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "키패드 누르기.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -402,6 +404,7 @@
33D0D94A29DD7FFC00183B04 /* 1463_1로 만들기.swift */,
33D0D94C29DD90B900183B04 /* 9095_1, 2, 3 더하기.swift */,
33D0D94E29DDF29B00183B04 /* 2579_계단 오르기.swift */,
33D0D95029DEC03200183B04 /* 11726_2×n 타일링.swift */,
);
path = Boj;
sourceTree = "<group>";
Expand Down Expand Up @@ -818,6 +821,7 @@
33AFF4D029CC525100D61BD4 /* MinAvgTwoSlice.swift in Sources */,
33AFF4EA29CEE3F700D61BD4 /* MinMaxDivision.swift in Sources */,
33B54EA829A0872300D2BECF /* 전광판.swift in Sources */,
33D0D95129DEC03200183B04 /* 11726_2×n 타일링.swift in Sources */,
33E90A3529D8817100CA532F /* 16918_봄버맨.swift in Sources */,
339FC6C629DC584F00CAA1F7 /* 가장 큰 정사각형 찾기.swift in Sources */,
333166CF296D492B00AF717B /* 문자열을 정수로 바꾸기.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Programmers/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

import Foundation

print(solution2579())
print(solution11726())

0 comments on commit 1c8e5c9

Please sign in to comment.