-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df3ce57
commit 1c8e5c9
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
|
||
import Foundation | ||
|
||
print(solution2579()) | ||
print(solution11726()) |